MCPcopy
hub / github.com/connectrpc/connect-go / httpToCode

Function httpToCode

protocol.go:401–424  ·  view source on GitHub ↗
(httpCode int)

Source from the content-addressed store, hash-verified

399}
400
401func httpToCode(httpCode int) Code {
402 // https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md
403 // Note that this is NOT the inverse of the gRPC-to-HTTP or Connect-to-HTTP
404 // mappings.
405
406 // Literals are easier to compare to the specification (vs named
407 // constants).
408 switch httpCode {
409 case 400:
410 return CodeInternal
411 case 401:
412 return CodeUnauthenticated
413 case 403:
414 return CodePermissionDenied
415 case 404:
416 return CodeUnimplemented
417 case 429:
418 return CodeUnavailable
419 case 502, 503, 504:
420 return CodeUnavailable
421 default:
422 return CodeUnknown
423 }
424}

Calls

no outgoing calls