Skip to content

Forcing CamelCase on headers #29

@mixdev

Description

@mixdev

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions