dapnet-core / database-service

DAPNET Database Service
GNU General Public License v3.0
3 stars 3 forks source link

/users does not give http answer header Content-Length #16

Closed dh3wr closed 5 years ago

dh3wr commented 5 years ago

Das Axios-Modul hätte wohl gerne einen Content-Lenght Header, sonst wird der error handler aufgerufen. Der ist nun nicht mehr da.

Vergleich: Geht mit axios

curl -v -u dh3wr:xxxxx http://44.225.164.51/auth/users/roles
*   Trying 44.225.164.51...
* TCP_NODELAY set
* Connected to 44.225.164.51 (44.225.164.51) port 80 (#0)
* Server auth using Basic with user 'dh3wr'
> GET /auth/users/roles HTTP/1.1
> Host: 44.225.164.51
> Authorization: Basic ZGgzd3I6ZGUxcmN3
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Wed, 24 Oct 2018 08:14:46 GMT
< Server: nginx/1.15.2
< X-Powered-By: Express
< content-type: application/json; charset=utf-8
< content-length: 26
< Vary: Accept-Encoding
< cache-control: max-age=0, private, must-revalidate
< Access-Control-Allow-Origin: *
< Authorization: Basic ZGwyaWM6dGVzdA==
< Access-Control-Allow-Origin: *
<
* Connection #0 to host 44.225.164.51 left intact
["admin","user","support"]

Geht nicht mit axios:

curl -v -u dh3wr:xxxx http://44.225.164.51/users/dh3wr
*   Trying 44.225.164.51...
* TCP_NODELAY set
* Connected to 44.225.164.51 (44.225.164.51) port 80 (#0)
* Server auth using Basic with user 'dh3wr'
> GET /users/dh3wr HTTP/1.1
> Host: 44.225.164.51
> Authorization: Basic ZGgzd3I6ZGUxcmN3
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Wed, 24 Oct 2018 08:15:39 GMT
< Server: nginx/1.15.2
< X-Powered-By: Express
< content-type: application/json;charset=UTF-8
< Vary: Accept-Encoding
< x-content-type-options: nosniff
< x-xss-protection: 1; mode=block
< cache-control: no-cache, no-store, max-age=0, must-revalidate
< pragma: no-cache
< expires: 0
< x-frame-options: DENY
< set-cookie: JSESSIONID=6043BF86F3F279F3775C7168038D2C4B; Path=/; HttpOnly
< Access-Control-Allow-Origin: *
< Authorization: Basic ZGwyaWM6dGVzdA==
< Access-Control-Allow-Origin: *
< Transfer-Encoding: chunked
<
* Connection #0 to host 44.225.164.51 left intact
{"_id":"dh3wr","_rev":"10-b3d47bcd2dc78c61707a1da24236cb94","email":"xxxx@xxxx.com","roles":["user","support"],"enabled":true,"created_on":"2018-07-08T11:50:02.168325Z","created_by":"dl2ic"}
dh3wr commented 5 years ago

this.$http.get scheint sich daran nicht zu stören.... Aber davon wollen wir uns ja verabschieden...

Taronyu commented 5 years ago

Das ist richtig so, da der Transfer Encoding Header verwendet wird. Der HTTP RFC sagt, dass dann Content-Length ignoriert werden muss. Das ist dann also eher ein Bug in axios.

dh3wr commented 5 years ago

es lag nicht daran, sondern der Grund war, dass axios bei nicht ausführbaren Zufriffen auch im success handler den error handler aufruft. Sorry...

Taronyu commented 5 years ago

Ah ok, dann hat sich das ja geklärt 😄