collective / sphinxcontrib-httpexample

Adds example directive for sphinx-contrib httpdomain
23 stars 20 forks source link

Curl builder fix #66

Closed LefterisJP closed 2 years ago

LefterisJP commented 2 years ago

This way for GET calls with a json body, curl will not default to a PUT as seen in rotki/rotki#2612

datakurre commented 2 years ago

@LefterisJP @kelsos Hi! sphinxcontrib-httpexample is not really abandoned, we just don't have resources to add new features unless we need them. As long as https://plonerestapi.readthedocs.io/en/latest/content.html uses it, it will be maintained by https://github.com/collective/ Thanks for using and sharing your issues!

But do these examples https://rotki.readthedocs.io/en/latest/api.html?highlight=from_timestamp#querying-asset-movements really work? I have never heard of mixing JSON payload with GET request. Do all those tools in examples have magical support to turn the data into querystring?

kelsos commented 2 years ago

@datakurre thank you for the reply.

Yes, a curl that has a JSON body and a GET request will properly work since the server can accept and parse the body.

At least from experience most of the servers I have worked with in the past will have no trouble accepting a JSON body in a GET request. When the client is anything but a browser this mixing works fine without any issue.

As far as I am aware the only platform that strictly enforces GET without a body is the browser.

datakurre commented 2 years ago

Cool! I really was not aware that, but makes sense specwise.

Would you consider it best practice to always specify verb with curl or only when there is payload (and curl would default to PUT)? On 3. Sep 2021, 21.24 +0300, Konstantinos Paparas @.***>, wrote:

@datakurre thank you for the reply. Yes, a curl that has a JSON body and a GET request will properly work since the server can accept and parse the body. At least from experience most of the servers I have worked with in the past will have no trouble accepting a JSON body in a GET request. When the client is anything but a browser this mixing works fine without any issue. As far as I am aware the only platform that strictly enforces GET without a body is the browser. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

LefterisJP commented 2 years ago

Cool! I really was not aware that, but makes sense specwise. Would you consider it best practice to always specify verb with curl or only when there is payload (and curl would default to PUT)?

I guess being explicit in these things is something I would consider the safest approach.

EDIT: Thanks for the response and for letting us know the project is still maintained. Totally get the need-to-have basis only kind of maintenance. Thank you for making this package.