Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Content-Type header not displayed in response examples. #330

Closed
1 task done
rickdubiel opened this issue Sep 25, 2021 · 2 comments
Closed
1 task done

PHP Content-Type header not displayed in response examples. #330

rickdubiel opened this issue Sep 25, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@rickdubiel
Copy link

rickdubiel commented Sep 25, 2021

I can't seem to get the PHP Content-Type header to display in any of the response examples. I've also noticed that it's not being displayed in the demo as well for ONLY the PHP language.

https://demo.scribe.knuckles.wtf/

For example it show's up in bash (and javascript, python, and ruby):

image

But not in php:

image

Thanks!

@rickdubiel rickdubiel added the bug Something isn't working label Sep 25, 2021
@shalvah
Copy link
Contributor

shalvah commented Sep 25, 2021

  • Those are request examples, not response examples.
  • The content type isn't included, because the Guzzle library, which the PHP examples use, automatically sets it based on the data you provide. For example, passing in json => [...] will set it to application/json.
  • The screenshot you shared is of a GET request, so there's no body content;there and hence no content-type, but if you check some other type, you'll see what I mean.
  • If you don't agree with this and will prefer to include your headers manually, you can override the language templates with yours. Can't get you the link rn, but it's described in the docs, under Advanced Customisation, I think.

@shalvah shalvah closed this as completed Sep 25, 2021
@rickdubiel
Copy link
Author

rickdubiel commented Sep 25, 2021

Those are request examples, not response examples.

My bad, I did mean request examples..

The content type isn't included, because the Guzzle library, which the PHP examples use, automatically sets it based on the data you provide.

That's interesting, but wouldn't you think we'd still want to display the Content-Type to whoever is integrating the api? Especially for folks like me who wasn't aware that Guzzle did that behind the scenes and MOSTLY for any of those not using Guzzle. I was trying to display a Content-Type of "application/x-www-form-urlencoded" in this case. I don't know, just feel like it'd be more clear that way.

The screenshot you shared is of a GET request, so there's no body content;there and hence no content-type, but if you check some other type, you'll see what I mean.

Sorry, bad examples but there is also a POST request on that demo without the Content-Type header as well (even though it's not shown due to bullet #2 above).

image

If you don't agree with this and will prefer to include your headers manually, you can override the language templates with yours. Can't get you the link rn, but it's described in the docs, under Advanced Customisation, I think.

Thank you for pointing this out! This will have to be the route I take.

Thank you so very much for the quick response! Love the package!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants