Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ public function __construct($base_url) {
// Using PHP 5.2, it cannot be initialised in the static context
$this->curl_opts[CURLOPT_HEADERFUNCTION] = array($this, 'handle_header');
}

// Lets you add a header to the header list
// Example: pest->addHeader("Accept", "application/xml");
public function addHeader($headerName, $value) {
try {
array_push($this->curl_opts[CURLOPT_HTTPHEADER], $headerName.":".$value);
} catch (Exception $e) {
$this->curl_opts[CURLOPT_HTTPHEADER] = array($headerName.":".$value);
}
}

// $auth can be 'basic' or 'digest'
public function setupAuth($user, $pass, $auth = 'basic') {
Expand Down