Download pkg/framework/transport/httptransport/encoder/encoder.go from Leon4gr45/openmeter: direct link, hf CLI and curl.
- Browser
- Download file 562 Bytes
-
https://huggingface.co/spaces/Leon4gr45/openmeter/resolve/main/pkg/framework/transport/httptransport/encoder/encoder.go
- Command line
-
hf download hf://spaces/Leon4gr45/openmeter/pkg/framework/transport/httptransport/encoder/encoder.go
-
curl -L -o encoder.go https://huggingface.co/spaces/Leon4gr45/openmeter/resolve/main/pkg/framework/transport/httptransport/encoder/encoder.go
562 Bytes
| package encoder | |
| import ( | |
| "context" | |
| "net/http" | |
| ) | |
| type ResponseEncoder[Response any] func(ctx context.Context, w http.ResponseWriter, r *http.Request, response Response) error | |
| // ErrorEncoder is responsible for encoding an error to the ResponseWriter. | |
| // Users are encouraged to use custom ErrorEncoders to encode HTTP errors to | |
| // their clients, and will likely want to pass and check for their own error | |
| // types. See the example shipping/handling service. | |
| type ErrorEncoder func(ctx context.Context, err error, w http.ResponseWriter, r *http.Request) bool | |