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

Set Content-type header in the API transport if the text to be sent is valid JSON #8282

Merged
merged 3 commits into from Feb 22, 2018

Conversation

Projects
None yet
4 participants
@nkaminski
Contributor

nkaminski commented Feb 21, 2018

This change makes the API transport attempt to decode the request body text that is to be posted to the API endpoint as JSON prior to the data being posted. If the body text is identified as valid JSON, the Content-type HTTP header is set to 'application/json', which is required by many API endpoints that expect JSON formatted inputs.

Please note

Please read this information carefully. You can run ./scripts/pre-commit.php to check your code before submitting.

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926

@CLAassistant

This comment has been minimized.

CLAassistant commented Feb 21, 2018

CLA assistant check
All committers have signed the CLA.

@nkaminski nkaminski closed this Feb 21, 2018

@nkaminski nkaminski reopened this Feb 21, 2018

@nkaminski nkaminski changed the title from Set Content-type header in the API transport if to Set Content-type header in the API transport if the text to be sent is valid JSON Feb 21, 2018

@laf laf added the API label Feb 22, 2018

@scrutinizer-notifier

This comment has been minimized.

scrutinizer-notifier commented Feb 22, 2018

The inspection completed: No new issues

@laf laf merged commit fca10c6 into librenms:master Feb 22, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details
@laf

This comment has been minimized.

Member

laf commented Feb 22, 2018

@nkaminski Thanks for contributing :)

wiad pushed a commit to wiad/librenms that referenced this pull request Feb 23, 2018

alerts: Set Content-type header in the API transport if the text to b…
…e sent is valid JSON (librenms#8282)

* Set Content-type header to application/json in the API transport if the text to be sent is valid JSON.

* Update Api.php

* Update Api.php

inetAnt added a commit to criteo-forks/librenms that referenced this pull request Mar 19, 2018

alerts: Set Content-type header in the API transport if the text to b…
…e sent is valid JSON (librenms#8282)

* Set Content-type header to application/json in the API transport if the text to be sent is valid JSON.

* Update Api.php

* Update Api.php
@lock

This comment has been minimized.

lock bot commented May 16, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed.

@lock lock bot locked as resolved and limited conversation to collaborators May 16, 2018

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