collective / sphinxcontrib-httpexample

Adds example directive for sphinx-contrib httpdomain
23 stars 20 forks source link

Fix request builder to pass form data as dictionary #89

Closed datakurre closed 9 months ago

datakurre commented 9 months ago

Fixes #88

coveralls commented 9 months ago

Coverage Status

coverage: 96.544% (+0.1%) from 96.437% when pulling 9142128ab186c5692b66a7f648b2c719c68157d9 on datakurre-fix-requests-form into f05f4a086de63f85738ab4a0afa31b93bd618c69 on master.

erral commented 9 months ago

With this changes, everything looks OK:

Example with encoded colons:

HTTP:

POST /@@oauth2-token HTTP/1.1
Accept: application/json
Content-type: application/x-www-form-urlencoded

grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=REDACTED

python-requests

requests.post('http://nohost/@@oauth2-token', headers={'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded'}, data={'grant_type': 'urn:ietf:params:oauth:grant-type:jwt-bearer', 'assertion': 'REDACTED'})

Example with plain non-encoded parameters:

HTTP

POST /@@oauth2-token HTTP/1.1
Accept: application/json
Content-type: application/x-www-form-urlencoded

grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&assertion=REDACTED

python-requests

requests.post('http://nohost/@@oauth2-token', headers={'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded'}, data={'grant_type': 'urn:ietf:params:oauth:grant-type:jwt-bearer', 'assertion': 'REDACTED'})