# Content Types Some HTTP requests including `POST`, `PUT` and `PATCH` can include content in the body of the request. The most common content types for upload data are... * HTML form submissions use the `application/x-www-form-urlencoded` content type. * HTML form submissions including file uploads use the `multipart/form-data` content type. * JSON data uses the `application/json` content type. Content can be included directly in a request by using bytes or a byte iterator and setting the appropriate `Content-Type` header.
```{ .python .httpx } >>> headers = {'Content-Type': 'application/json'} >>> content = json.dumps({"number": 123.5, "bool": [True, False], "text": "hello"}) >>> response = cli.put(url, headers=headers, content=content) ``` ```{ .python .ahttpx .hidden } >>> headers = {'Content-Type': 'application/json'} >>> content = json.dumps({"number": 123.5, "bool": [True, False], "text": "hello"}) >>> response = await cli.put(url, headers=headers, content=content) ``` There are also several classes provided for setting the request content. These implement either the `Content` or `StreamingContent` API, and handle constructing the content and setting the relevant headers. * `