How Do I Properly Set a Custom curl Header in My Request? or What’s the Best Way to Pass Headers Usin

20 Replies, 805 Views

Your curl header syntax is correct, but the server might ignore `Content-Type` if it’s not required. Try adding a dummy header like `-H "X-Test: foo"` to see if *that* gets through.

For multiple headers, stacking `-H` is the way to go. No cleaner method, really.

If you’re tired of curl’s quirks, maybe try `httpie`—it’s like curl but with saner defaults for headers and JSON.

Messages In This Thread



Users browsing this thread: 1 Guest(s)