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

please implement http put and delete in httpClient #8777

Closed
juancarlospaco opened this issue Aug 25, 2018 · 8 comments

Comments

Projects
None yet
5 participants
@juancarlospaco
Copy link
Contributor

commented Aug 25, 2018

  • Implement HTTP PUT and DELETE methods on httpClient and asyncHttpClient.
@hlaaftana

This comment has been minimized.

Copy link
Contributor

commented Aug 25, 2018

I don't understand, does it not work?

@juancarlospaco

This comment has been minimized.

Copy link
Contributor Author

commented Aug 25, 2018

Theres no HTTP PUT and DELETE methods on httpClient and asyncHttpClient.

@hlaaftana

This comment has been minimized.

Copy link
Contributor

commented Aug 25, 2018

There's no put or delete proc, but you still can use PUT and DELETE.

import httpclient, asyncdispatch

let client = newAsyncHttpClient()
let response = await client.request("http://httpbin.org/put", HttpPut)

The HTTP method enum is in the httpcore module which httpclient exports but I guess that might be hard to find in the documentation. If you want to add put and delete alias procs to httpclient you can define them in your own code.

@juancarlospaco

This comment has been minimized.

Copy link
Contributor Author

commented Aug 25, 2018

It would be nice just to have:

  • httpClient.put()
  • httpClient.delete()
  • asyncHttpClient.put()
  • asyncHttpClient.delete()

Yes I know theres workaround and hacks you can use on your own code, also some API use an HTTP header to "fake" a PUT with a POST, but even more if you say theres super easy to implement, then would be nice to have, instead of additional hacks, I am not complaining about the design or anything else, I just say would be nice to have those useful procs in.
🐱

@huglyfe

This comment has been minimized.

Copy link

commented Aug 27, 2018

I'm going to take a look at this over the next few days. Good idea.

@juancarlospaco

This comment has been minimized.

Copy link
Contributor Author

commented Aug 28, 2018

I appreciate the quick response and the good work, keep it up 😸

@dom96

This comment has been minimized.

Copy link
Member

commented Oct 27, 2018

This should be fairly easy to solve.

Simply replicate the get and post procs, change the HTTP method that they are using and that should be all that's needed. These procedures are just simple aliases for what @hlaaftana showed.

@krux02 krux02 changed the title HTTP PUT DELETE please implement http put and delete in httpClient Oct 28, 2018

tonygparsehub added a commit to tonygparsehub/Nim that referenced this issue Oct 28, 2018

tonygparsehub added a commit to tonygparsehub/Nim that referenced this issue Oct 29, 2018

tonygparsehub added a commit to tonygparsehub/Nim that referenced this issue Oct 29, 2018

tonygparsehub added a commit to tonygparsehub/Nim that referenced this issue Oct 29, 2018

tonygparsehub added a commit to tonygparsehub/Nim that referenced this issue Oct 29, 2018

tonygparsehub added a commit to tonygparsehub/Nim that referenced this issue Oct 30, 2018

@dom96 dom96 closed this in 4bb472e Nov 23, 2018

dom96 added a commit that referenced this issue Nov 23, 2018

Merge pull request #9548 from tonygparsehub/put-delete
fix #8777 add missing http methods in httpClient
@juancarlospaco

This comment has been minimized.

Copy link
Contributor Author

commented Nov 24, 2018

Thanks everyone for the excellent work, the improvements really make a less verbose and human code. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.