xqerl icon indicating copy to clipboard operation
xqerl copied to clipboard

restXQ

Open grantmacken opened this issue 4 years ago • 2 comments

restXQ implementation

I have opened this issue to monitor of the restXQ implementation status for xqerl.

current status re. HTTP methods

  • [X] GET e.g. http://example.com
  • [X] GET with query parameters
    e.g. curl http://example.com/?h=entry&content=Burn+Out
  • [x] HEAD
    e.g curl --head http://example.com
  • [x] OPTIONS e.g curl -X OPTIONS http://example.com
  • [x] POST HTML form posting with Content-Type application/x-www-form-urlencoded
    curl --data-urlencode "name=xqerl app" http://www.example.com
  • [x] POST multipart form file upload with Content-Type multipart/form-data e.g.curl --form upload=@localfilename http://www.example.com
  • [x] POST base64 encoded application data with Content-Type: application/json or Content-Type: application/xml
 curl -H "Content-Type: application/json" \\
 -d  '{"h":"entry","content":"giday"}' \\
http://www.example.com/micropub

should return 201 status + location header

  • [ ] PUT send base64 application data with 'Content-Type: application/json' or 'Content-Type: application/xml'
curl -X PUT \\
 -H "Content-Type: application/json" \\
 -d  '{"h":"entry","content":"giday"}' \\
http://www.example.com/micropub/id
  • [ ] PUT upload a file Content-Type: application/json or Content-Type: application/xml
curl --upload-file path/to/file
 -H "Content-Type: application/xml" \\
http://www.example.com/data/id
  • [ ] DELETE Content-Type: application/json or Content-Type: application/xml e.g. curl -X DELETE http://www.example.com/micropub/id

grantmacken avatar Oct 21 '19 22:10 grantmacken

@zadean re. RESTXQ fixup and test suite #21

The OPTIONS HTTP method is not yet handled correctly, and the options_1 test case run, does not uncover the error.

The restXQ endpoint /test/options/xml should 'allow' only 'GET,HEAD' response. yet the cowboy response is

 < allow: DELETE, GET, HEAD, OPTIONS, POST

The following is the call and output from curl

* Connected to localhost (127.0.0.1) port 8081 (#0)
> OPTIONS /test/options/xml HTTP/1.1
> Host: localhost:8081
> User-Agent: curl/7.66.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< allow: DELETE, GET, HEAD, OPTIONS, POST
< content-length: 0
< date: Sun, 10 Nov 2019 18:06:57 GMT
< server: Cowboy

grantmacken avatar Nov 10 '19 18:11 grantmacken

okay, I think #24 fixed it. It now handles OPTIONS calls, instead of deferring to the default.

zadean avatar Nov 11 '19 13:11 zadean