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

Forcing CamelCase on headers #29

Open
mixdev opened this issue May 9, 2020 · 0 comments
Open

Forcing CamelCase on headers #29

mixdev opened this issue May 9, 2020 · 0 comments

Comments

@mixdev
Copy link

mixdev commented May 9, 2020

The tool is CamelCasing header names. It also deduplicates afterwards. Which is creating confusion. Look at the below request. I need both Cache-Control & cache-control to be sent but the converter removes the second header. Also, check apikey: it converts it to Apikey

Here's the request

curl -X POST https://thathost.com \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'apikey: xxx' \
-H 'cache-control: no-cache' \
-d 'something-doesntmatter-payload'

that generates

// Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://thathost.com');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "something-doesntmatter-payload");

$headers = array();
$headers[] = 'Cache-Control: no-cache';
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
$headers[] = 'Apikey: xxx';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close($ch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant