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

Made the mime type configureable. - #17

Open
florianwagner81 wants to merge 1 commit into
ekino:masterfrom
florianwagner81:master
Open

Made the mime type configureable.#17
florianwagner81 wants to merge 1 commit into
ekino:masterfrom
florianwagner81:master

Conversation

@florianwagner81

Copy link
Copy Markdown

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

rande commented Aug 11, 2016

Copy link
Copy Markdown
Contributor

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

@florianwagner81

Copy link
Copy Markdown
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

pokap commented Aug 12, 2016

Copy link
Copy Markdown
Contributor

Possibly disable the check content-type is better ?

EntryPoint::$contentType = false;

@rande

rande commented Aug 16, 2016

Copy link
Copy Markdown
Contributor

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