Open lorypelli opened 7 months ago
@lorypelli In the earlier versions, error handling and returns were not implemented in order to quickly identify errors. However, based on your feedback, I have added error handling and returns in version v0.9.0 instead of causing panics. The error handling may not be comprehensive enough yet. If you encounter any issues, please feel free to provide feedback. Thank you for your suggestion.
@lorypelli In the earlier versions, error handling and returns were not implemented in order to quickly identify errors. However, based on your feedback, I have added error handling and returns in version v0.9.0 instead of causing panics. The error handling may not be comprehensive enough yet. If you encounter any issues, please feel free to provide feedback. Thank you for your suggestion.
thanks, now it gives an error in -H
when pasting this:
curl "https://wails.io/assets/js/6264.be098870.js" ^
-H "accept: */*" ^
-H "accept-language: it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7" ^
-H ^"cookie: ph_phc_UcoO1U6kbh3MRDXFF3Y5ycUIY15UklNky7NNhLyOupC_posthog=^%^7B^%^22distinct_id^%^22^%^3A^%^22018f1bda-30fd-7b0c-b061-76a8445efdb8^%^22^%^2C^%^22^%^24sesid^%^22^%^3A^%^5B1714940203879^%^2C^%^22018f4a66-d367-7919-b99b-bc62268a8bd2^%^22^%^2C1714940203879^%^5D^%^7D^" ^
-H "referer: https://wails.io/docs/gettingstarted/installation" ^
-H ^"sec-ch-ua: ^\^"Chromium^\^";v=^\^"124^\^", ^\^"Google Chrome^\^";v=^\^"124^\^", ^\^"Not-A.Brand^\^";v=^\^"99^\^"^" ^
-H "sec-ch-ua-mobile: ?0" ^
-H ^"sec-ch-ua-platform: ^\^"Windows^\^"^" ^
-H "sec-fetch-dest: script" ^
-H "sec-fetch-mode: no-cors" ^
-H "sec-fetch-site: same-origin" ^
-H "user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"
this is from Copy as cURL (cmd) option on chrome, same if I try with bash option
@lorypelli Supports copying as cURL command only (Bash), I let me check and fix it.
@lorypelli The v0.9.1 version has already addressed this issue. If you are still encountering problems, please provide the Bash command with the curl string. I can fix it, but currently, support is limited to curl commands in Bash format only; other formats are not supported at this time.
@lorypelli Supports copying as cURL command only (Bash), I let me check and fix it.
You should give error saying only bash is supported and not windows
@lorypelli Supports copying as cURL command only (Bash), I let me check and fix it.
You should give error saying only bash is supported and not windows
The v0.10.0 version has already Add Parse, ParseBash, ParseCmd to make them compatible with the cmd format.
@lorypelli Supports copying as cURL command only (Bash), I let me check and fix it.
You should give error saying only bash is supported and not windows
The v0.10.0 version has already Add Parse, ParseBash, ParseCmd to make them compatible with the cmd format.
Thanks a lot, this is the best support I received in an issue, good...😉🙂
I changed the title to better understand what the issue is for other people
still doesn't work
it gives a parse error now
curl 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap' \
-H 'sec-ch-ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"' \
-H 'Referer: https://github.com/474420502/gcurl/issues/3' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "Windows"'
the alert is from an app I'm making using also your package
tried both with cmd and bash
@lorypelli I tried it and it's normal. The above curl bash can be executed smoothly.
@lorypelli I tried it and it's normal. The above curl bash can be executed smoothly.
So, I'm using wrong method, I use Parse
function
curl := gcurl.Parse(url)
url
is correct
@lorypelli you try it v0.10.0
I'm using latest version
@lorypelli
scurl := `curl 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap' \
-H 'sec-ch-ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"' \
-H 'Referer: https://github.com/474420502/gcurl/issues/3' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "Windows"'`
cu, err := Parse(scurl)
if err != nil {
log.Panic(err)
}
resp, err := cu.Temporary().Execute()
if err != nil {
log.Panic(err)
}
log.Println(resp.ContentString())
@lorypelli
scurl := `curl 'https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap' \ -H 'sec-ch-ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"' \ -H 'Referer: https://github.com/474420502/gcurl/issues/3' \ -H 'sec-ch-ua-mobile: ?0' \ -H 'sec-ch-ua-platform: "Windows"'` cu, err := Parse(scurl) if err != nil { log.Panic(err) } resp, err := cu.Temporary().Execute() if err != nil { log.Panic(err) } log.Println(resp.ContentString())
https://github.com/lorypelli/FetchTTP/blob/main/app.go#L336-L372
@lorypelli I think this will help
@lorypelli I think this will help
it adds http protocol twice, either if the url is http or https
and URL is not correctly parsed
ah, it's the same error as before
@lorypelli The problem may stem from inadequate support for Windows. I'll consider enhancing support for Windows at a later date; I don't have the time this month.
@lorypelli Try version v0.11.0, but since I currently don't have access to a Windows system, I'm unable to test your specific scenario. I can only make some attempts based on what's possible.
I'm finding issues with your libraries, a lot of time parsing doesn't work and you should return an error which is usually done in go, please do this, it's a good practice to have