From 48c887f5a16527e6241c3e6eec6f19c12a590af0 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Fri, 8 Sep 2023 08:40:37 -0700 Subject: [PATCH] Clarify default encoding responsability --- docs/standard-library/http/encoding.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/standard-library/http/encoding.md b/docs/standard-library/http/encoding.md index 432690c13e3..f7cbb1dec5e 100644 --- a/docs/standard-library/http/encoding.md +++ b/docs/standard-library/http/encoding.md @@ -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 @@ -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.