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

Are there any plans to create HttpClient or WebClient or HttpWebRequest objects from HAR object/file? #13

Open
VAllens opened this issue Mar 15, 2022 · 7 comments

Comments

@VAllens
Copy link

VAllens commented Mar 15, 2022

Are there any plans to create HttpClient or WebClient or HttpWebRequest objects from HAR object/file?
This will allow us to easily create HttpClient or WebClient or HttpWebRequest and quickly populate the relevant request parameters/content/body !!!

@VAllens
Copy link
Author

VAllens commented Mar 15, 2022

If you don't have this plan, I would maybe consider implementing a component library on your own.

@RonSijm
Copy link

RonSijm commented May 26, 2022

@VAllens - I'm checking out this library because my intention to to generate Swagger / OpenAPI specs from HAR files.

(Which in my opinion would be preferable to directly generating a HttpClient, since you can just generate practically anything once you have a swagger spec file)

Since you were considering implementing something similar, have you made any progress? Cause then I might be able to collaborate on your work or use parts of your work for my own project

@VAllens
Copy link
Author

VAllens commented May 27, 2022

@VAllens - I'm checking out this library because my intention to to generate Swagger / OpenAPI specs from HAR files.

(Which in my opinion would be preferable to directly generating a HttpClient, since you can just generate practically anything once you have a swagger spec file)

Since you were considering implementing something similar, have you made any progress? Cause then I might be able to collaborate on your work or use parts of your work for my own project

@RonSijm Hi, RonSijm.

Our goal may be different. My goal is to realize a semi-automatic test service.

After the user (exported from Fiddler or Chrome or other tools) imports the har file and fills in the URL, the service can request the URL at a specific time and do something.

At present, there is no progress.
If there is progress, I will open source in GitHub.

@RonSijm
Copy link

RonSijm commented May 27, 2022

@VAllens Sounds like you could do that in the way I was suggesting.

In my approach, once you have generated an OpenAPI spec file, you can easily read it in using Nswag or microsoft/OpenAPI.NET.

From there I made a small console app that sends all the operations through a Liquid Template (I already have that part working for existing OpenAPI spec docs, might release it once I have it all up and running) (If I can clear it from being proprietary)

So if you can convert Hars to OpenAPI, you can use a liquid template to generate the test services.

Only thing is that you'd have to compile the output of the liquid templates, so if your goal is to let end-users import a Har file and do everything you mentioned at runtime, then yea, my approach won't work for that

(Though I was doing something similar to that - doing everything at runtime reflection/parsing, but that approach is 100s of times slower than creating a code-generator first, compiling it, and using that)

I made some progress converting Hars into OpenAPI specs, but not enough to commit, hehe. There are a lot of things to map

@VAllens
Copy link
Author

VAllens commented May 30, 2022

@RonSijm
Thank you for your suggestion, although it is not my desired goal.
I'm glad you made progress. 😄

@Giorgi
Copy link

Giorgi commented Jul 23, 2022

@VAllens Is this what you are looking for? https://github.com/nventive/HttpRecorder

@VAllens
Copy link
Author

VAllens commented Jul 26, 2022

@VAllens Is this what you are looking for? https://github.com/nventive/HttpRecorder

This is interesting.

It has part of the implementation I want.

Thank you for sharing. :) @Giorgi

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

3 participants