Issue #201: /_admin/api method create_user responds with Content-Length field twice (conservancy/kallithea)

Krzysztof Słonka issues-reply at bitbucket.org
Mon Mar 28 09:57:44 UTC 2016


New issue 201: /_admin/api method create_user responds with Content-Length field twice
https://bitbucket.org/conservancy/kallithea/issues/201/_admin-api-method-create_user-responds

Krzysztof Słonka:

Hello,

doing a http request like this:

```
#!http

POST /_admin/api HTTP/1.1
host: 127.0.0.1:8080
accept: application/json
content-type: application/json
Content-Length: 317
Connection: close

{"id":"bdb52f80-f4c9-11e5-8eed-3525bf27bc51","api_key":"__REMOVED_KEY__","method":"create_user","args":{"username":"k2","email":"krzysztofslonka+8 at gmail.com","password":"__REMOVED_PASSWORD__","firstname":"X","lastname":"X"}}
```

Produces a response like this:

```
#!http

HTTP/1.1 200 OK
Cache-Control: no-cache
Connection: close
Content-Length: 297
Content-Length: 297
Content-Type: application/json
Date: Mon, 28 Mar 2016 09:49:08 GMT
Pragma: no-cache
Server: waitress

{"error": null, "id": "bdb52f80-f4c9-11e5-8eed-3525bf27bc51", "result": {"msg": "created new user `k2`", "user": {"username": "k2", "user_id": 8, "firstname": "X", "admin": false, "lastname": "X", "emails": ["krzysztofslonka+8 at gmail.com"], "active": true, "email": "krzysztofslonka+8 at gmail.com"}}}
```

The response has 'Content-Length: 297' twice, which causes node http parser to fail with: 

```
#!json
{ [Error: Parse Error] bytesParsed: 95, code: 'HPE_UNEXPECTED_CONTENT_LENGTH' }
```

If I modify the response myself and remove one instance of 'Content-Length' then everything is fine.

I've installed kallithea 0.3.1 from pip (using this tutorial https://pythonhosted.org/Kallithea/installation.html#installing-a-released-version-in-a-virtualenv)




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sfconservancy.org/pipermail/kallithea-general/attachments/20160328/7bed0eaf/attachment.html>


More information about the kallithea-general mailing list