Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does Http only support GET and POST? #9896

Closed
NQNStudios opened this issue Sep 27, 2020 · 2 comments
Closed

Why does Http only support GET and POST? #9896

NQNStudios opened this issue Sep 27, 2020 · 2 comments

Comments

@NQNStudios
Copy link
Contributor

Teaching myself from the docs, it seems to me that the Haxe standard library only has a unified interface for making GET requests and POST requests.

This is my conclusion based on the HttpBase docs here: https://api.haxe.org/haxe/http/HttpBase.html:

This class can be used to handle Http requests consistently across platforms. There are two intended usages:

call haxe.Http.requestUrl(url) and receive the result as a String (not available on flash)
create a new haxe.Http(url), register your callbacks for onData, onError and onStatus, then call request().

Is this a deliberate choice? Why wouldn't Http.request() accept a string or enum choosing any of the valid HTTP request methods, instead of just a bool for post?

@NQNStudios
Copy link
Contributor Author

Slightly related: it is weird that requestUrl is documented on HttpBase, which doesn't seem to declare the method. I thought I would be able to use requestUrl on all platforms by using the haxe.Http typedef, but it doesn't work for node JS:

src/hiss/wrappers/HHttp.hx:35: characters 21-31 : Class<haxe.http.HttpNodeJs> has no field requestUrl`

@RealyUniqueName
Copy link
Member

I've updated HttpBase docs.
As for request methods I guess it's the legacy of times when other request methods were almost never used on the web.
We will implement better HTTP API during our work on a new asys APIs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants