Skip to content

pkg/http headers should be case-insensitive #13

Closed
@DartBot

Description

@DartBot

Originally opened as dart-lang/sdk#17062

This issue was originally filed by [email protected]


When using the code snippet below, the content-type header is overloaded by "text/plain".

  import 'package:http/http.dart' as Http;
  Http.post(url, body: postData, headers: { "Content-Type": "text/xml" })

As we can't set _contentType from Request class, could you add 'content-type' in basic client requests also ? (see 'request.dart' source code)

  set body(String value) {
    bodyBytes = encoding.encode(value);
    var contentType = _contentType;
    if (contentType == null) {
      contentType = new ContentType("text", "plain", charset: encoding.name);
    } else if (contentType.charset == null) {
      contentType = new ContentType(contentType.primaryType,
                                    contentType.subType,
                                    charset: encoding.name,
                                    parameters: contentType.parameters);
    }
    _contentType = contentType;
  }

Environement
Dart VM version: 1.1.3 (Thu Feb 06 00:05:52 2014) on "windows_ia32"
http package: http-0.9.2+3

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions