CURL code generation not working
See original GitHub issueDescribe the bug “Generate Code” and “Copy as CURL” functionality not working
To Reproduce Steps to reproduce the behavior:
- Create request
- Click on “Generate Code” or “Copy as CURL”
Expected behavior Generated CURL code or CURL request in clipboard
Screenshots An error in developer tools console:
/opt/Insomnia/resources/app.asar/node_modules/tough-cookie/lib/cookie.js:941 Uncaught (in promise) TypeError: Cannot read property 'getTime' of null
at Cookie.expiryTime (/opt/Insomnia/resources/app.asar/node_modules/tough-cookie/lib/cookie.js:941)
at matchingCookie (/opt/Insomnia/resources/app.asar/node_modules/tough-cookie/lib/cookie.js:1175)
at Array.filter (<anonymous>)
at /opt/Insomnia/resources/app.asar/node_modules/tough-cookie/lib/cookie.js:1188
at MemoryCookieStore.findCookies (/opt/Insomnia/resources/app.asar/node_modules/tough-cookie/lib/memstore.js:113)
at CookieJar.getCookies (/opt/Insomnia/resources/app.asar/node_modules/tough-cookie/lib/cookie.js:1183)
at CookieJar.getCookiesSync (/opt/Insomnia/resources/app.asar/node_modules/tough-cookie/lib/cookie.js:1452)
at getRequestCookies (bundle.js:74505)
at exportHarWithRenderedRequest (bundle.js:74493)
at process._tickCallback (internal/process/next_tick.js:68)
Desktop (please complete the following information):
- OS: Linux Mint 19.3 Tricia
- Installation Method: deb package
- App Version
2020.3.3
(though didn’t work on2020.2.2
either)
Additional context
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (11 by maintainers)
Top Results From Across the Web
curl, API request works in Insomnia, but not in generated code ...
When I send it via Insomnia, no problemo. But when I generate source code for curl, it shows me this. curl --request POST...
Read more >curl_error - Manual - PHP
Returns a clear text error message for the last cURL operation. ... close the current cURL session or the error message will be...
Read more >build and install curl from source
This document does not describe how to install curl or libcurl using such a binary package. This document describes how to compile, build...
Read more >Exit status - Everything curl
If you write a shell script or batch file that invokes curl, you can always check the return code to detect problems in...
Read more >Generate Code for cURL not work - Help - Postman community
hi, I try to use a code generate for cURL (windows), but not work, please see … Have any idea ?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve started to work on this, but there is something weird in the cookies modal logic.
I’ve taken a record when I’ve created a cookie and played with the
Expires
attributeAs you can see, there is something wrong. I’ve found the cause in those lines: https://github.com/Kong/insomnia/blob/c73092e2947d3eaf059473086b178fa2fe117df0/packages/insomnia-app/app/ui/components/modals/cookie-modify-modal.js#L112-L117
When we are saving changes, the value in
cookie.expires
is"0"
instead of0
. Therefore we are “generating” a date usingnew Date('0')
which different thannew Date(0)
🤯We should fix that, but I’d like your thoughts on what format we want to use in the
Expires
input? I’m thinking about:1603396449844
Thu, 22 Oct 2020 19:54:09 GMT
2020-10-22T19:54:09.844Z
I would use the 3rd option, the ISO string, which seems to be the simpler. Indeed, I can’t convert the epoch time in my head, and we would need to update the day matching the new date using the UTC. 🤔
Of course, this format would be used only in the input field. We would then adapt it when we update the cookie.
@jrodalo Thanks! I can reproduce 🎉 🙇