Ganesan-Chandran / vscode-fetch-client

Fetch Client is Visual Studio Code extension which is used to test the Rest API.
https://marketplace.visualstudio.com/items?itemName=GanesanChandran.fetch-client
MIT License
13 stars 6 forks source link

import from Curl #5

Closed moshikd closed 2 months ago

moshikd commented 2 years ago

it will be great if import from curl will be implemented in the near future. this will make the use o this extension really meaningful

Ganesan-Chandran commented 2 years ago

Hi @moshikd ,

Sure. Will implement import from curl in upcoming release. Thanks for your feedback.

Ganesan-Chandran commented 2 years ago

This feature has implemented and released in the v1.2.0 Please update the Fetch Client. Let me know your feedback. Thanks.

moshikd commented 2 years ago

Thanks Gansen, i checked it and it seems to work But still some issues. when i import the curl api --> i do not see the api that was sent. for instance, i copy an api from chrome Dev tools (using right click--> copy as curl) and then i copy the curl into fetch client: New Request — API_Testing 22-07-08 21-39

another issue is that the copy of the body will nor be imported as form encode. it shows only as raw . i can share the curl api is needed ( it just a sample)

Ganesan-Chandran commented 2 years ago

Hi @moshikd ,

Could you please share the curl sample similar to your usecase?

moshikd commented 2 years ago

yes. see below: curl 'https://gw.test.be/api/init' \ -H 'authority: gw.test.be' \ -H 'accept: */*' \ -H 'accept-language: en-US,en;q=0.9' \ -H 'cache-control: no-cache' \ -H 'content-type: application/x-www-form-urlencoded' \ -H 'origin: https://www.teamtalk.com' \ -H 'pragma: no-cache' \ -H 'referer: https://www.teamtalk.com/' \ -H 'sec-ch-ua: ".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"' \ -H 'sec-ch-ua-mobile: ?0' \ -H 'sec-ch-ua-platform: "macOS"' \ -H 'sec-fetch-dest: empty' \ -H 'sec-fetch-mode: cors' \ -H 'sec-fetch-site: cross-site' \ -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36' \ --data-raw $'meta=%7B%22adup%22%3A%22%2F124312541%2FPlanet_Sports%2Fteamtalk%2Fhome_adhesion%22%2C%22dest%22%3A%22%22%2C%22w%22%3A%22970%22%2C%22h%22%3A%2290%22%2C%22li%22%3A%224958388617%22%2C%22adv%22%3A%224692353928%22%2C%22ord%22%3A%222489577083%22%2C%22cr%22%3A%22138260035857%22%2C%22ygIds%22%3A%220%22%2C%22aduid%22%3A%22%25epid\u0021%22%2C%22haduid%22%3A%22%25esid\u0021%22%2C%22isAfc%22%3A%220%22%2C%22isAmp%22%3A%22false%22%2C%22isEBDA%22%3A%22false%22%2C%22qid%22%3A%22COGA4q-O6_gCFVuIdwodXCYMPA%22%2C%22cust_imp%22%3A%22%25cust_imp\u0021%22%2C%22cust1%22%3A%22%25cust1\u0021%22%2C%22cust2%22%3A%22%25cust2\u0021%22%2C%22cust3%22%3A%22%25cust3\u0021%22%2C%22caid%22%3A%22%22%2C%22adElId%22%3A%22browsi_adContainer_ai_-1_ati_1_rc_0%22%2C%22topUrl%22%3A%22https%3A%2F%2Fwww.teamtalk.com%2F%22%2C%22ua%22%3A%22Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_15_7)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F103.0.0.0%20Safari%2F537.36%22%2C%22aDomains%22%3A%5B%22robocorp.com%22%5D%7D&key=3b0bd2ec-2938-46f0-b403-b64360c6fbe6&imp=6fc3bb72-d531-4286-b73b-3f57ece02908&c_ver=1.1.103&w_ver=1.1.77&w_type=gpt&b_ver=v0.5.165&ver=0.1&loc=https%3A%2F%2Fwww.teamtalk.com%2F&ref=&sp=dfp&cust1=%25cust1\u0021&cust2=%25cust2\u0021&cust3=%25cust3\u0021&caid=&qid=COGA4q-O6_gCFVuIdwodXCYMPA&cdn=cloudfront&cid=138260035857&li=4958388617&ord=2489577083&ygIds=0&at=p&hbTag=true&hbVendor=pbjs&hbCid=44_FLWIUQ6MMRD73LEMMS5WWA_728x90_1&hbAdId=132b53a4d91c5997&hbBidder=gumgum&hbCpm=1.46&hbCurrency=GBP&isEBDA=false&pimp=72b7cd76-c1b0-48da-88c1-6ae533c71624&preloaded=1342.199999988079&site=www.teamtalk.com&isc=true&ts=1657345838821&bdTs=1657339920' \ --compressed

moshikd commented 2 years ago

Hi Gansen, did my example help you? do you need anything else?

will it be resolved soon?

thanks again :)

Ganesan-Chandran commented 2 years ago

Hi @moshikd ,

Thanks for sample data. I am working on it. It will resolve coming release.

Ganesan-Chandran commented 2 years ago

Hi @moshikd

Issue has been fixed and released in v1.3.0. Please update the Fetch Client and let me know your feedback. Thanks.

moshikd commented 2 years ago

Hi @Ganesan-Chandran i tested it and it works BUT the request method is not imported correctly. flow:

  1. i import api from chrome dev tools ( right click > copy > copy as curl)
  2. i import it to fetch client

issue: the request method ( let's say it is POST ) will not be imported . i noticed it is GET . i think that when importing the request api from curl - it should also recognize the request method.

I really appreciate your effort and assistance.

Ganesan-Chandran commented 2 years ago

Hi @moshikd ,

Thanks for your feedback. Will fix this issue in next release.

Ganesan-Chandran commented 2 months ago

Hi @moshikd

Thank you for using the Fetch Client extension. This issue is fixed in the latest version Fetch Client v1.5.1

Please update the Fetch Client and let me know if you have any queries/feedback.