Made the mime type configureable.
I think it might be very helpful for others as well to make the default content mime type configurable as it was causing issues for pure "application/json" API i.e.
This cannot be done with a static variable as we can consume 2 differents API within the same request lifetime.
What do you suggest?
What is needed:
- Set the Content Type before each query
- (Optional) Reset to default after query
Possible solution:
- Set Content Type like in my fork?! (see example below)
- Adding a new parameter whith default value to the parse function (That would mean several other changes to pass the parameter through.)
- Change EntryPoint construtor to accept contentType
Atm I run my queries like this:
// get resource from remote
$entryPoint = new EntryPoint($query, $client);
$entryPoint::setDefaultContentType("application/json");
$resource = $entryPoint->get();
Possibly disable the check content-type is better ?
EntryPoint::$contentType = false;
The best option will be to add a options parameters. And of course this will require to change different methods signature.
@pokap's solution can work too, but maybe with a different name: checkContentType