Skip to content

Latest commit

 

History

History
39 lines (31 loc) · 901 Bytes

File metadata and controls

39 lines (31 loc) · 901 Bytes

Quick Test Commands

Test the Improved Error Message

Windows CMD:

python -m httpie POST https://httpbin.org/post "data:={\"bad json\"}"

Windows PowerShell:

python -m httpie POST https://httpbin.org/post "data:={\"bad json\"}"

What you should see:

http: error: 'data:={"bad json"}': Invalid JSON provided in request body.
Check your quotes, commas, and brackets.
Example:
  data:='{"name": "John"}'

Verify Exit Code (PowerShell):

python -m httpie POST https://httpbin.org/post "data:={\"bad json\"}"
$LASTEXITCODE  # Should show 1

Verify Exit Code (CMD):

python -m httpie POST https://httpbin.org/post "data:={\"bad json\"}"
echo %ERRORLEVEL%  # Should show 1

Test Valid JSON (should work normally):

python -m httpie POST https://httpbin.org/post "data:={\"name\": \"John\", \"age\": 30}"