Skip to content

QuickStart documentation error #6949

Open
@trin5tensa

Description

@trin5tensa

httpbin post has a header item '"X-Amzn-Trace-Id" which causes an result which is contrary to the documentation.

Quickstart documentation

"More complicated POST requests"

payload_tuples = [('key1', 'value1'), ('key1', 'value2')]
r1 = requests.post('https://httpbin.org/post', data=payload_tuples)
payload_dict = {'key1': ['value1', 'value2']}
r2 = requests.post('https://httpbin.org/post', data=payload_dict)
print(r1.text)
{
  ...
  "form": {
    "key1": [
      "value1",
      "value2"
    ]
  },
  ...
}
r1.text == r2.text
True

Actual Result

Reproduction Steps

import requests
payload_tuples = [('key1', ' "value1'),('key1', 'value2')]
payload_dict = {'key1': ['value1', 'value2']}
r1 = requests.post('https://httpbin.org/post', data=payload_tuples)
r2 = requests.post('https://httpbin.org/post', data=payload_dict)
r1.text == r2.text
False
r1.json()['form'] == r2.json()['form']
True

Diagnostic Information

pprint.pprint(r1.text)
('{…
' "form": {\n'
' "key1": [\n'
' "value1", \n'
' "value2"\n'
' ]}

' "X-Amzn-Trace-Id": "Root=1-682cb364-67bf5e846c56c77e24839642"\n'
'… },

pprint.pprint(r2.text)
('{…
' "form": {\n'
' "key1": [\n'
' "value1", \n'
' "value2"\n'
' ]}

' "X-Amzn-Trace-Id": "Root=1-682cb30f-208ede8e2eda5cf75cf578ac"\n'
' … },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions