Skip to content
This repository was archived by the owner on Apr 20, 2021. It is now read-only.
This repository was archived by the owner on Apr 20, 2021. It is now read-only.

Not possible to set content-type header #217

@razbakov

Description

@razbakov

Steps to reproduce:

behatch/contexts: dev-master (version 20c5910)

Scenario:

  Scenario: Create a Project                                    
    When I add "Accept" header equal to "application/json"
    And I add "Accept-Language" header equal to "xx"
    And I add "Content-Type" header equal to "application/json"
    And I send a "POST" request to "/projects" with body:
      """
      {"name": "test"}
      """

There is controller in the application with Request $request object.
There is call in controller: dump($request->headers).

Actual result:
Output is:

Symfony\Component\HttpFoundation\HeaderBag {#4548
  #headers: array:7 [
    "host" => array:1 [
      0 => "127.0.0.1"
    ]
    "user-agent" => array:1 [
      0 => "Symfony BrowserKit"
    ]
    "accept" => array:1 [
      0 => "application/json"
    ]
    "accept-language" => array:1 [
      0 => "xx"
    ]
    "accept-charset" => array:1 [
      0 => "ISO-8859-1,utf-8;q=0.7,*;q=0.7"
    ]
    "content-type" => array:1 [
      0 => "application/x-www-form-urlencoded"
    ]
    "x-php-ob-level" => array:1 [
      0 => 1
    ]
  ]

Expected result:
Output is:

Symfony\Component\HttpFoundation\HeaderBag {#4548
  #headers: array:7 [
    "host" => array:1 [
      0 => "127.0.0.1"
    ]
    "user-agent" => array:1 [
      0 => "Symfony BrowserKit"
    ]
    "accept" => array:1 [
      0 => "application/json"
    ]
    "accept-language" => array:1 [
      0 => "xx"
    ]
    "accept-charset" => array:1 [
      0 => "ISO-8859-1,utf-8;q=0.7,*;q=0.7"
    ]
    "content-type" => array:1 [
      0 => "application/json"
    ]
    "x-php-ob-level" => array:1 [
      0 => 1
    ]
  ]

Notes:

As you see all headers, except content-type are set correctly.

Might be related:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions