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

Copy as Curl not respecting header case #2615

Closed
michbsd opened this issue Sep 15, 2020 · 4 comments · Fixed by #2668
Closed

Copy as Curl not respecting header case #2615

michbsd opened this issue Sep 15, 2020 · 4 comments · Fixed by #2668
Labels
B-bug Bug: general classification E-good-first-issue Experience required: Beginner / New

Comments

@michbsd
Copy link

michbsd commented Sep 15, 2020

When doing "Copy as Curl" on a request - the header is copied in all lower case.
E.g. I have a query with a header called "X-Application" - when doing a "Copy as Curl" it is copied as "x-application"

Desktop (please complete the following information):

  • OS: macOS 10.15.6
  • Installation Method: dmg
    Version: Insomnia Core 2020.4.0
    Release date: 10/09/2020
    OS: Darwin x64 19.6.0
    Electron: 9.1.1
    Node: 12.14.1
    V8: 8.3.110.13-electron.0
    Architecture: x64
    node-libcurl: libcurl/7.69.1 OpenSSL/1.1.1g zlib/1.2.11 brotli/1.0.7 libidn2/2.1.1 libssh2/1.9.0 nghttp2/1.41.0
@develohpanda develohpanda added B-bug Bug: general classification E-good-first-issue Experience required: Beginner / New Hacktoberfest labels Sep 16, 2020
@develohpanda
Copy link
Contributor

develohpanda commented Sep 16, 2020

For anybody venturing into this issue and would like to pick it up, here is the generation logic 😄 Losing case may either be happening during exportHarRequest, or during HTTPSnippet convert.

async _handleCopyAsCurl(request) {
const { activeEnvironment } = this.props;
const environmentId = activeEnvironment ? activeEnvironment._id : 'n/a';
const har = await exportHarRequest(request._id, environmentId);
const snippet = new HTTPSnippet(har);
const cmd = snippet.convert('shell', 'curl');
clipboard.writeText(cmd);
}

@jgiovaresco
Copy link
Contributor

I can confirm that we are loosing case during snippet conversion. It seems related to Kong/httpsnippet#74 🤔

@develohpanda
Copy link
Contributor

Kong/httpsnippet#178 has been merged, which resolves the linked issue - thanks @jgiovaresco! Once a new version of httpsnippet is released, it will just be a matter of updating Insomnia to consume that new version.

@reynolek
Copy link
Contributor

1.23.0 for httpsnippet has been released: https://github.com/Kong/httpsnippet/releases/tag/1.23.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-bug Bug: general classification E-good-first-issue Experience required: Beginner / New
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants