File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -4,15 +4,15 @@ import { otlpExporter } from "~/v3/otlpExporter.server";
4
4
5
5
export async function action ( { request } : ActionFunctionArgs ) {
6
6
try {
7
- const contentType = request . headers . get ( "content-type" ) ;
7
+ const contentType = request . headers . get ( "content-type" ) ?. toLowerCase ( ) ?? "" ;
8
8
9
- if ( contentType === "application/json" ) {
9
+ if ( contentType . startsWith ( "application/json" ) ) {
10
10
const body = await request . json ( ) ;
11
11
12
12
const exportResponse = await otlpExporter . exportLogs ( body as ExportLogsServiceRequest ) ;
13
13
14
14
return json ( exportResponse , { status : 200 } ) ;
15
- } else if ( contentType === "application/x-protobuf" ) {
15
+ } else if ( contentType . startsWith ( "application/x-protobuf" ) ) {
16
16
const buffer = await request . arrayBuffer ( ) ;
17
17
18
18
const exportRequest = ExportLogsServiceRequest . decode ( new Uint8Array ( buffer ) ) ;
Original file line number Diff line number Diff line change @@ -4,15 +4,15 @@ import { otlpExporter } from "~/v3/otlpExporter.server";
4
4
5
5
export async function action ( { request } : ActionFunctionArgs ) {
6
6
try {
7
- const contentType = request . headers . get ( "content-type" ) ;
7
+ const contentType = request . headers . get ( "content-type" ) ?. toLowerCase ( ) ?? "" ;
8
8
9
- if ( contentType === "application/json" ) {
9
+ if ( contentType . startsWith ( "application/json" ) ) {
10
10
const body = await request . json ( ) ;
11
11
12
12
const exportResponse = await otlpExporter . exportTraces ( body as ExportTraceServiceRequest ) ;
13
13
14
14
return json ( exportResponse , { status : 200 } ) ;
15
- } else if ( contentType === "application/x-protobuf" ) {
15
+ } else if ( contentType . startsWith ( "application/x-protobuf" ) ) {
16
16
const buffer = await request . arrayBuffer ( ) ;
17
17
18
18
const exportRequest = ExportTraceServiceRequest . decode ( new Uint8Array ( buffer ) ) ;
You can’t perform that action at this time.
0 commit comments