CorentinTh / it-tools

Collection of handy online tools for developers, with great UX.
https://it-tools.tech
GNU General Public License v3.0
18.92k stars 2.28k forks source link

HTTP Request Tool #837

Open Trip7274 opened 6 months ago

Trip7274 commented 6 months ago

What tool do you want? Example: an HTTP request tool

Describe the solution you'd like A simple, powerful, and easily shareable HTTP request tool, where you can also export the request in curl format, or even a few popular languages

Is their example of this tool in the wild? Cyberchef has a good implementation, but I found it doesn't work very well with some requests for some reason, namely Cloudflare API calls

Additional context Having a "share" button maybe nice, along with a warning if you had any authorization headers to avoid leaking your tokens, but that's not a requirement for it to be an amazing tool

sharevb commented 2 months ago

Hi @iGamerTrip, this is not really possible from a browser, JS cannot access everywhere, will require a local application or server side, so probably not the goal of this project

But a curl command generator could be possible

Trip7274 commented 2 months ago

While i dont know a lot about JS, I've noticed that Cyberchef does have that functionality from the browser, and so does Postman

It also doesn't necessarily need to be able to access everywhere, just public APIs and the like Postman seems to suggest fetch() for JS, and here's an example code snippet it provided:

const requestOptions = {
  method: "GET",
  redirect: "follow"
};

fetch("https://api.sampleapis.com/switch/games", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result)) // Returns a list of Switch games!
  .catch((error) => console.error(error));

I apologize if this is simply unfeasible, or if I'm misunderstanding things, as my area of expertise lies moreso in Python than JS, but I thought this might help get my point across

sharevb commented 2 months ago

Hi, yes, for api calls, (supposing CORS policy is ok), but will not work for websites as JS is not allowed to call everywhere (security)

By the way curl generator and translation to langages is possible

Trip7274 commented 2 months ago

Yeah, a better name for this issue is probably "API Request Tool", as it'd be good to test APIs (with proper CORS policies) with And a curl/popular languages generator would be really cool as well!

sharevb commented 1 month ago

HI @Trip7274 and @CorentinTh, implemented i #1168

Trip7274 commented 1 month ago

Thanks a ton!