Skip to content

Commit

Permalink
Accept octet-stream as media type for multipart text fields (#2746)
Browse files Browse the repository at this point in the history
  • Loading branch information
987Nabil committed Jun 21, 2024
1 parent 8de4a41 commit 2c2b552
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
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

0 comments on commit 2c2b552

Please sign in to comment.