-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Allow configuring which req/res body content types to log (#407)
Some req/res body content types are more useful to log than others. For example, it's not generally helpful to log `image/x-icon` or `text/javascript`. However, it can still be very useful for debugging to log things like `application/json` or `application/x-www-form-urlencoded`. Allow configuring which content types to allow to be logged. By default, all content types are allowed. Currently, only exact matches of content types are supported, so using `text/*` will not match `text/plain`, for example. Closes #390
- Loading branch information
1 parent
f8d2a22
commit 53d7f02
Showing
7 changed files
with
358 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use crate::error::Error; | ||
|
||
#[derive(Debug, Error)] | ||
#[non_exhaustive] | ||
pub enum MimeError { | ||
#[error(transparent)] | ||
FromStr(#[from] mime::FromStrError), | ||
|
||
#[error(transparent)] | ||
Other(#[from] Box<dyn std::error::Error + Send + Sync>), | ||
} | ||
|
||
impl From<mime::FromStrError> for Error { | ||
fn from(value: mime::FromStrError) -> Self { | ||
Self::Mime(MimeError::from(value)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.