grpc / grpc/grpc-rust

Content-Type Validation Missing: Requests Not Returning HTTP 415 When Content-Type Is Not Start with `application/grpc`

Open
#1,720 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
12.5k
Forks
1.3k
Avg merge
4d 7h
Merged PRs (30d)
24

Description

## Bug Report

### Version
master branch

### Crates
`tonic` `tonic-build`

### Description
When receiving a request with a content-type that does not start with application/grpc, the tonic library does not return HTTP status of 415. According to the [gRPC](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md) documentation, if the content-type does not start with application/grpc, an HTTP status code 415 should be returned.

I believe this issue could be resolved by adding a check for the content-type in the code generated by tonic-build. I am willing to submit a PR to address this issue if needed. Thank you for considering this enhancement to the tonic library.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.