@@ -431,11 +431,25 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request
431
431
carVersion := formatParams ["version" ]
432
432
i .serveCAR (r .Context (), w , r , resolvedPath , contentPath , carVersion , begin )
433
433
return
434
- case "application/vnd.ipld.dag-json" , "application/json" :
434
+ case "application/json" :
435
+ if resolvedPath .Cid ().Prefix ().Codec == uint64 (mc .Json ) {
436
+ logger .Debugw ("serving json" , "path" , contentPath )
437
+ i .serveCodec (r .Context (), w , r , resolvedPath , contentPath , begin , responseFormat , uint64 (mc .Json ))
438
+ return
439
+ }
440
+ fallthrough
441
+ case "application/vnd.ipld.dag-json" :
435
442
logger .Debugw ("serving dag-json" , "path" , contentPath )
436
443
i .serveCodec (r .Context (), w , r , resolvedPath , contentPath , begin , responseFormat , uint64 (mc .DagJson ))
437
444
return
438
- case "application/vnd.ipld.dag-cbor" , "application/cbor" :
445
+ case "application/cbor" :
446
+ if resolvedPath .Cid ().Prefix ().Codec == uint64 (mc .Cbor ) {
447
+ logger .Debugw ("serving cbor" , "path" , contentPath )
448
+ i .serveCodec (r .Context (), w , r , resolvedPath , contentPath , begin , responseFormat , uint64 (mc .Cbor ))
449
+ return
450
+ }
451
+ fallthrough
452
+ case "application/vnd.ipld.dag-cbor" :
439
453
logger .Debugw ("serving dag-cbor" , "path" , contentPath )
440
454
i .serveCodec (r .Context (), w , r , resolvedPath , contentPath , begin , responseFormat , uint64 (mc .DagCbor ))
441
455
return
0 commit comments