TestingAPIs is still being built. If something breaks, email support@testingapis.com.

Detects a body's real type from its content and compares it with the declared Content-Type

POSTPUTPATCHhttps://api.testingapis.com/api/bodies/anySign in to see this endpoint's URL

Accepts POST, PUT and PATCH, up to 10MB. Recognises PNG, JPEG, GIF, PDF, ZIP and gzip by magic bytes, then JSON, HTML, XML, URL-encoded form, multipart and plain text; anything else is application/octet-stream.

Request body

Optional. application/octet-stream, application/json. Any body; the real type is detected and compared with Content-Type.

Example body
{"hello": "world"}

Responses

200
Declared and detected types, length and SHA-256.
413
Body larger than 10MB.

Example

Request
curl -X POST "https://api.testingapis.com/api/bodies/any" \
  -H "Content-Type: application/json" \
  -d '{"hello": "world"}' \
  -H "X-TestingApis-Key: YOUR_API_KEY"
Response200 OK
{
  "method": "POST",
  "declaredContentType": "application/json",
  "detectedType": "application/json",
  "matchesDeclared": true,
  "length": 18,
  "sha256": "5f8f04f6a3a892aaabbddb6cf273894493773960d4a325b105fee46eef4304f1"
}

Sign in to see the details

The parameters, request and response examples and the live Try it panel for this endpoint are for signed-in members. Accounts are free and take a few seconds to create.