Closed TimOgilvy closed 7 years ago
The default server headers assume the API will provide either JSON or XML but never explicitly require it. This means that switching the accept type with an API like intuit which currently always returns XML for user info, creates an error.
Server.php on line 355
355
355 | protected function getHttpClientDefaultHeaders() 356 | { 357 | $defaultHeaders = array(); 358 | if (!empty($this->userAgent)) { 359 | $defaultHeaders['User-Agent'] = $this->userAgent; 359 | } 360 | 361 | return $defaultHeaders; 362 | }
I'm Recommending:
355 | protected function getHttpClientDefaultHeaders() 356 | { 357 | $defaultHeaders = array(); 358 | if (!empty($this->userAgent)) { 359 | $defaultHeaders['User-Agent'] = $this->userAgent; 359 | } 360 | $defaultHeaders['Accept'] = 'application/'. $this->responseType; 361 | 362 | return $defaultHeaders; 363 | }
Not sure if I am being pedantic but I figure an application probably shouldn't assume an encoding type unless it's requested it in the first place?
I'm extending this repo to build an entire quickbooks api subscriber and I want to switch from xml to json as soon as I have the user info.
Wait should I have made that PR on dev? Sorry.
Closing as per conversation on the pull request.
The default server headers assume the API will provide either JSON or XML but never explicitly require it. This means that switching the accept type with an API like intuit which currently always returns XML for user info, creates an error.
Server.php on line
355
I'm Recommending:
Not sure if I am being pedantic but I figure an application probably shouldn't assume an encoding type unless it's requested it in the first place?
I'm extending this repo to build an entire quickbooks api subscriber and I want to switch from xml to json as soon as I have the user info.