Inklings-io / selfauth

self-hosted auth_endpoint using simple login mechanism
Creative Commons Zero v1.0 Universal
81 stars 15 forks source link

No default response type #30

Closed sebsel closed 3 years ago

sebsel commented 7 years ago

Seems like we have no default response type at this moment. Is there something to default to?

When I send this:

POST / HTTP/1.1
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Host: selfauth.dev
Connection: close
User-Agent: Paw/3.1.3 (Macintosh; OS X/10.12.6) GCDHTTPRequest
Content-Length: 172

code=[...]

I get the following response:

Notice: Undefined index: HTTP_ACCEPT in /Users/Seb/code/selfauth/index.php on line 170

Notice: Undefined index: HTTP_ACCEPT in /Users/Seb/code/selfauth/index.php on line 173 Error: No Accepted Response Types

The client accepts neither JSON nor Form encoded responses.

Zegnat commented 7 years ago

Definitely a bug because I didn’t read the Accept specification carefully. I was working under the assumption that the Accept header would be included on all requests, but you made a request without it. In this case, Accept: */* should be implied.

For */* (which means form encoding and JSON are equally accepted) we default to JSON, though I would love it to default form encoding (see #12).