blob: 3f4ef3abd8733adb8d42cb840d3a352361919962 [file] [log] [blame]
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// @dart = 2.9
/// @assertion ContentType(
/// String primaryType,
/// String subType, {
/// String charset,
/// Map<String, String> parameters
/// })
/// Creates a new content type object setting the primary type and sub type. The
/// charset and additional parameters can also be set using charset and
/// parameters. If charset is passed and parameters contains charset as well the
/// passed charset will override the value in parameters. Keys passed in
/// parameters will be converted to lower case. The charset entry, whether
/// passed as charset or in parameters, will have its value converted to
/// lower-case.
/// @description Checks that keys passed in parameters will be converted to lower
/// case.
/// @author sgrekhov@unipro.ru
import "dart:io";
import "../../../Utils/expect.dart";
main() {
ContentType contentType = new ContentType("TEXT", "HTML",
parameters: {"P1": "V1"});
Expect.equals("TEXT/HTML", contentType.mimeType);
Expect.equals("TEXT", contentType.primaryType);
Expect.equals("HTML", contentType.subType);
Expect.mapEquals({"p1": "V1"}, contentType.parameters);
}