Skip to content

Commit d25c6b2

Browse files
committed
feat(reactive-rpc): 🎸 extract codec types from Content-Type header
1 parent 4d50415 commit d25c6b2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/reactive-rpc/server/http1/Http1Server.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ export class Http1Server implements Printable {
136136
const ip = this.findIp(req);
137137
const token = this.findToken(req);
138138
const ctx = new Http1ConnectionContext(req, res, path, query, ip, token, match.params, new NullObject(), codecs.value.json, codecs.value.json, codecs.messages.compact);
139+
const headers = req.headers;
140+
const contentType = headers['content-type'];
141+
if (typeof contentType === 'string') ctx.setCodecs(contentType, codecs);
139142
const handler = match.data.handler;
140143
await handler(ctx);
141144
} catch (error) {

0 commit comments

Comments
 (0)