Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept octet-stream as media type for multipart text fields (#2746) #2926

Merged
merged 1 commit into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private[cli] final case class CliEndpoint(

lazy val getOptions: List[HttpOptions] = url ++ headers ++ body

def describeOptions(description: Doc) =
def describeOptions(description: Doc): CliEndpoint =
self.copy(
body = self.body.map(_ ?? description),
headers = self.headers.map(_ ?? description),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ object EndpointGen {
)

def withDoc[A] = Mapper[CliReprOf[Codec[A]], Doc](
(repr, doc) => CliRepr(repr.value ?? doc, repr.repr.copy(body = repr.repr.body.map(_ ?? doc))),
(repr, doc) => CliRepr(repr.value ?? doc, repr.repr.describeOptions(doc)),
anyDoc,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,9 @@ object HttpContentCodec {
def only[A](implicit schema: Schema[A]): HttpContentCodec[A] = {
HttpContentCodec(
ListMap(
MediaType.text.`plain` ->
MediaType.text.`plain` ->
BinaryCodecWithSchema(zio.http.codec.internal.TextBinaryCodec.fromSchema[A](schema), schema),
MediaType.application.`octet-stream` ->
BinaryCodecWithSchema(zio.http.codec.internal.TextBinaryCodec.fromSchema[A](schema), schema),
),
)
Expand Down
Loading