postman-code-generators icon indicating copy to clipboard operation
postman-code-generators copied to clipboard

Add Support for C# HttpClient code gen

Open justindbaur opened this issue 4 years ago • 10 comments
trafficstars

Is your feature request related to a problem? Please describe.

I would love if Postman had the ability to generate code for making HTTP calls using the built in HttpClient in System.Net.Http. Some companies have requirement to not use outside packages so using only things built into .NET could be helpful.

Describe the solution you'd like

I would like it to generate code as close to the best practices as described by Microsoft and shown in this example.

Additional context

I am going to personally start working on this and will hopefully be referencing this issue in a pull request soon.

justindbaur avatar Feb 11 '21 00:02 justindbaur

@justindbaur any updates on this? This would be an awesome feature!

Misiu avatar Aug 25 '21 09:08 Misiu

@Misiu Yeah sorry. I did kinda give up on this for a while but if there is some more interest I think I should be able to finish it up. Currently I am failing two tests but I think I am close. I will try to make it a little bit more of a priority and try to have it done within a few weeks.

Failing tests:

should generate snippet for emptyFormdataCollection request: POST empty Formdata
should generate snippet for formdataCollection request: POST multipart/form-data with text parameters

justindbaur avatar Aug 26 '21 21:08 justindbaur

Thank you for the update 🙂

Misiu avatar Aug 27 '21 06:08 Misiu

@Misiu Since you had shown some interest in it. I have just finished the implementation in #453. I was wondering if you could take a look at the samples and see if they look good to you. I want it to be a good introduction for people so I want it to be as close to how people would use it without getting to crazy.

justindbaur avatar Sep 12 '21 01:09 justindbaur

does it release now?

yuzd avatar Oct 03 '21 13:10 yuzd

@yuzd It will need to be reviewed, approved, and merged by someone at postman. It doesn't look like a lot of resources are directed at this repo so it might take some time. I will do my best to be responsive to any issues with the pull request when a review comes my way though. Probably best to be subscribed to the linked PR.

justindbaur avatar Oct 03 '21 15:10 justindbaur

thanks ! this is great job for csharp

yuzd avatar Oct 04 '21 11:10 yuzd

@umeshp7 we need this. Can be merged and released?

jvitor83 avatar Feb 23 '22 22:02 jvitor83

Let me know how I can help @umeshp7

justindbaur avatar Feb 24 '22 19:02 justindbaur

With the breaking changes introduced in RestSharp v107, and Postman not supporting RestSharp code generation for version 107 or higher, having HttpClient code generation in Postman would be a great addition to the software.

markandrew21 avatar Sep 09 '22 12:09 markandrew21