question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Example showing how to set headers

See original GitHub issue

I looked through issues including closed ones and was suprised that nobody asked before but how do you set headers?

I tried using curl.setOpt(Curl.option.HEADER, { 'Content-Type': 'application.json' }) and then running a request in verbose mode but it looks like the headers are not set…

I can’t imagine this is the first time anybody has asked, please let me know where there are some docs on how to do this. It looks like none of the 19 examples that you have use headers at all?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
vomccommented, Nov 27, 2019

Yeah that makes sense! Thanks for looking into it! Happy to submit a PR with an updated README.md if that helps…

was thinking just update



curl.setOpt(Curl.option.URL, '127.0.0.1/upload.php');
curl.setOpt(Curl.option.HTTPPOST, [
    { name: 'input-name', file: '/file/path', type: 'text/html' },
    { name: 'input-name2', contents: 'field-contents' }
]);

and then maybe an example with header

Setting HTTP headers

Pass an array of strings specifying headers

curl.setOpt(Curl.option.HTTPHEADER,
  ['Content-Type: application/x-amz-json-1.1'])
0reactions
JCMaiscommented, Nov 27, 2019

Feel free to do so @vomc, that would be really great.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Headers.set() - Web APIs - MDN Web Docs - Mozilla
The set() method of the Headers interface sets a new value for an existing header inside a Headers object, or adds the header...
Read more >
Adding or modifying headers on HTTP requests and responses
Edit headers · In the Name field, enter the name of your header rule (for example, My header ). · From the Type...
Read more >
Set up your header row - Microsoft Support
To confirm that Power Query recognized your headers in the top row, select Home > Transform, and then select Use first row as...
Read more >
How to Set a Header on a Response with Spring 5 | Baeldung
In this section, we'll learn how to set headers on single endpoint responses using ServerHttpResponse, ResponseEntity or ServerResponse (for ...
Read more >
HTTP Headers for Dummies - Code - Envato Tuts+
If the server settings do not allow the display of the folder contents, you will get a 403 error. For example, on my...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found