Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Content-Type to Response produced 2 Content-Type headers #310

Closed
vlads-copart opened this issue Apr 27, 2017 · 1 comment
Closed
Labels

Comments

@vlads-copart
Copy link

vlads-copart commented Apr 27, 2017

curl -v localhost:8000
>GET / HTTP/1.1
>Host: localhost:8000
>User-Agent: curl/7.52.1
>Accept: */*

HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: BaseHTTP/0.3 Python/2.7.12
< Date: Thu, 27 Apr 2017 20:30:54 GMT
< Content-Length: 83
< Content-Type: application/xml
< Content-Type: application/xml
<
Curl_http_done: called premature == 0
Closing connection 0
<?xml version="1.0" encoding="UTF-8"?><Response><Say>Hello World</Say>

@jamesls
Copy link
Member

jamesls commented Apr 28, 2017

Confirmed bug, thanks for reporting.

from chalice import Chalice, Response

app = Chalice(app_name='headerfix')


@app.route('/', content_types=['application/json'])
def index():
    return Response(body='{"foo": "bar"}',
                    status_code=200,
                    headers={'Content-Type': 'application/json'})
$ chalice local &
$ curl -vv localhost:8000
* Rebuilt URL to: localhost:8000/
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8000 (#0)
> GET / HTTP/1.1
> Host: localhost:8000
> User-Agent: curl/7.43.0
> Accept: */*
>
127.0.0.1 - - [27/Apr/2017 17:09:26] "GET / HTTP/1.1" 200 -
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: BaseHTTP/0.3 Python/2.7.12
< Date: Fri, 28 Apr 2017 00:09:26 GMT
< Content-Length: 14
< Content-Type: application/json
< Content-Type: application/json
<
* Closing connection 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants