Skip to content

Commit 9c4fa36

Browse files
authored
Specify content-type header requirement (#7289)
* specify content-type header * stab
1 parent 5f58209 commit 9c4fa36

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

docs/Reference.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,10 @@ Clients may append more information and metadata to the _end_ of this string as
235235
> warn
236236
> Client requests that do not have a valid User Agent specified may be blocked and return a [Cloudflare error](https://support.cloudflare.com/hc/en-us/articles/360029779472-Troubleshooting-Cloudflare-1XXX-errors).
237237
238+
### Content Type
239+
240+
Clients using the HTTP API must provide a valid `Content-Type` header, either `application/json`, `application/x-www-form-urlencoded`, or `multipart/form-data`, except where specified. Failing to do so will result in a `50035` "Invalid form body" error.
241+
238242
### Rate Limiting
239243

240244
The HTTP API implements a process for limiting and preventing excessive requests in accordance with [RFC 6585](https://tools.ietf.org/html/rfc6585#section-4). API users that regularly hit and ignore rate limits will have their API keys revoked, and be blocked from the platform. For more information on rate limiting of requests, please see the [Rate Limits](#DOCS_TOPICS_RATE_LIMITS/rate-limits) section.

docs/events/Webhook_Events.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ If either of these are not complete, your Webhook Events URL will not be validat
4545

4646
When adding your Webhook Events URL, Discord will send a `POST` request with a `PING` payload with a `type: 0` to your endpoint. Your app is expected to acknowledge the request by returning a `204` response with an empty body.
4747

48+
> info
49+
> You must provide a valid `Content-Type` when responding to `PING`s. See [here](#DOCS_REFERENCE/http-api) for further information.
50+
4851
<Collapsible title="Responding to PING Requests" description="Code example for acknowledging PING events" icon="code">
4952
To properly acknowledge a `PING` payload, return a `204` response with no body:
5053

docs/interactions/Overview.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ If either of these are not complete, your Interactions Endpoint URL will not be
8080

8181
When adding your Interactions Endpoint URL, Discord will send a `POST` request with a `PING` payload with a `type: 1` to your endpoint. Your app is expected to acknowledge the request by returning a `200` response with a `PONG` payload (which has the same `type: 1`). Details about interaction responses are in the [Receiving and Responding documentation](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING).
8282

83+
> info
84+
> You must provide a valid `Content-Type` when responding to `PING`s. See [here](#DOCS_REFERENCE/http-api) for further information.
85+
8386
<Collapsible title="Responding to PING Requests" description="Code example for acknowledging PING interactions" icon="code">
8487
To properly acknowledge a `PING` payload, return a `200` response with a payload of `type: 1`:
8588

docs/interactions/Receiving_and_Responding.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ Now that you've gotten the data from the user, it's time to respond to them.
200200

201201
Interactions--both receiving and responding--are webhooks under the hood. So responding to an Interaction is just like sending a webhook request!
202202

203+
> info
204+
> Interaction responses have the same header requirements as normal HTTP API requests. See [here](#DOCS_REFERENCE/http-api) for further information.
205+
203206
There are a number of ways you can respond to an interaction:
204207

205208
### Interaction Response Object

0 commit comments

Comments
 (0)