<html><body>
<p>New issue 201: /_admin/api method create_user responds with Content-Length field twice <a href="https://bitbucket.org/conservancy/kallithea/issues/201/_admin-api-method-create_user-responds">https://bitbucket.org/conservancy/kallithea/issues/201/_admin-api-method-create_user-responds</a></p>
<p>Krzysztof SÅ‚onka:</p>
<p>Hello,</p>
<p>doing a http request like this:</p>
<p>``` #!http</p>
<p>POST /_admin/api HTTP/1.1 host: 127.0.0.1:8080 accept: application/json content-type: application/json Content-Length: 317 Connection: close</p>
<p>{"id":"bdb52f80-f4c9-11e5-8eed-3525bf27bc51","api_key":"__REMOVED_KEY__","method":"create_user","args":{"username":"k2","email":"krzysztofslonka+8@gmail.com","password":"__REMOVED_PASSWORD__","firstname":"X","lastname":"X"}} ```</p>
<p>Produces a response like this:</p>
<p>``` #!http</p>
<p>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</p>
<p>{"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@gmail.com"], “active”: true, “email”: "krzysztofslonka+8@gmail.com"}}} ```</p>
<p>The response has ‘Content-Length: 297’ twice, which causes node http parser to fail with:</p>
<p>``` #!json { [Error: Parse Error] bytesParsed: 95, code: ‘HPE_UNEXPECTED_CONTENT_LENGTH’ } ```</p>
<p>If I modify the response myself and remove one instance of ‘Content-Length’ then everything is fine.</p>
<p>I've installed kallithea 0.3.1 from pip (using this tutorial <a href="https://pythonhosted.org/Kallithea/installation.html#installing-a-released-version-in-a-virtualenv">https://pythonhosted.org/Kallithea/installation.html#installing-a-released-version-in-a-virtualenv</a>)</p>
<img src="http://link.bitbucket.org/wf/open?upn=7V-2FmRl-2BatdmBwUBFXbsB13NVJlEXqBigXyxfn0HY8gb734ofWR-2Fbbq5jwybzy1EMYORC2EcgHJtYtduDnNklovPMro5fX0qGwHscPcNOJQuI5S-2BWe6NDy2R48aDHLLg-2Fpth959PD-2BTySqaPaEiAL5H-2F8mlKZw6xnPrMJNDOAdTbBeLxC0kZuIeUjrgbMW3QgF2-2BrDKZrLzRrAorJ9gezZ7-2Bi2Q-2Fro-2Bhzybm-2BUZgPVKVH3gEUp7rkyG4056nAszMk" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;"/>
</body></html>