Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/standard-library/http/encoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ This document describe how the http library interpret TypeSpec built-in types an
- `bytes` are serialized as `base64` when used inside a model serialized as JSON
- In request or response body it represent a binary payload.

:::note
This behavior is only a specification and MUST be respected by the emitter. The http library DOES NOT automatically apply the `@encode("base64")` when used inside a JSON model.
:::

Use `@encode` to configure

```tsp
Expand All @@ -31,6 +35,10 @@ op upload(@body data: bytes): void; // Accept application/octet-stream
- Encoded as `rfc7231` when used in a header
- Encoded as `rfc3339` otherwise.

:::note
This behavior is only a specification and MUST be respected by the emitter. The http library DOES NOT automatically apply the `@encode("rfc7231")` on `utcDatetime` and `offsetDateTime` when used in a header.
:::

Use `@encode` to configure.

<table>
Expand Down