Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upURL redirection when www.fairdomhub.org is used in API create #105
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When trying to create objects by API at FAIRDOMhub, I used a wrong address, namely
www.fairdomhub.org instead of fairdomhub.org (Thank you ALan for helping me to find this out :)
Instead of creating an object (e.g. a study as listed below) the response was a list of studies. It seems that www prefixed address is good for GET but not for POST/PUT.
When using the www prefixed address, API requests are redirected (HTTP/1.1 302 Found) to the correct one (no www), but the object is not created. Details of communication is listed below.
Since www prefix is ok for reading, it is confusing when the writing doesn't work - I suggest that API checks the correctness of the URL and returns an informative error (Wrong URL, omit www, or something like that) instead of returning a list of objects (with 200 OK).
The communication transcript of unsuccesful study creation is below:
-> POST /studies HTTP/1.1
-> Host: www.fairdomhub.org
-> Authorization: Basic YWJsZWplYzpBYmluay45OTEy
-> User-Agent: https://github.com/ablejec/pisar
-> Accept-Encoding: deflate, gzip
-> Accept: application/json
-> Content-Type: application/json
-> Content-Length: 780
->
<- HTTP/1.1 302 Found
<- Date: Mon, 18 Nov 2019 11:53:47 GMT
<- Server: Apache/2.4.29 (Ubuntu)
<- Location: https://fairdomhub.org/studies
<- Content-Length: 299
<- Content-Type: text/html; charset=iso-8859-1
<-
-> GET /studies HTTP/1.1
-> Host: fairdomhub.org
-> Authorization: Basic YWJsZWplYzpBYmluay45OTEy
-> User-Agent: https://github.com/ablejec/pisar
-> Accept-Encoding: deflate, gzip
-> Cookie: _seek_session=c0f915c94294803c39b6b6276ec474b7
-> Accept: application/json
-> Content-Type: application/json
->
<- HTTP/1.1 200 OK
<- Date: Mon, 18 Nov 2019 11:53:47 GMT
<- Server: Apache/2.4.29 (Ubuntu)
<- Cache-Control: max-age=0, private, must-revalidate
<- Referrer-Policy: strict-origin-when-cross-origin
<- X-Permitted-Cross-Domain-Policies: none
<- X-XSS-Protection: 1; mode=block
<- X-Request-Id: 346f82f8-aca4-4653-8030-9017bae57489
<- X-Download-Options: noopen
<- X-Frame-Options: SAMEORIGIN
<- X-Runtime: 0.110233
<- X-Content-Type-Options: nosniff
<- X-Powered-By: Phusion Passenger 5.1.2
<- Set-Cookie: _seek_session=c0f915c94294803c39b6b6276ec474b7; path=/; expires=Mon, 18 Nov 2019 12:53:47 -0000; HttpOnly
<- ETag: W/"111c98e5c02b77ed4e028d5948423c9c"
<- Status: 200 OK
<- Transfer-Encoding: chunked
<- Content-Type: application/vnd.api+json; charset=utf-8
<-