Skip to content
This repository was archived by the owner on Jan 29, 2024. It is now read-only.

Conversation

@florianwagner81
Copy link

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.

@rande
Copy link
Contributor

rande commented Aug 11, 2016

This cannot be done with a static variable as we can consume 2 differents API within the same request lifetime.

@florianwagner81
Copy link
Author

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

@pokap
Copy link
Contributor

pokap commented Aug 12, 2016

Possibly disable the check content-type is better ?

EntryPoint::$contentType = false;

@rande
Copy link
Contributor

rande commented Aug 16, 2016

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants