mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-16 04:12:16 +01:00
improving logging (#5)
* small refactoring of error messages * (very) small refactoring of structs instantiation * improving logging with debug messages * using INFO level as default + changing previous debug message to info message
This commit is contained in:
@@ -15,8 +15,10 @@ const MultipartFormDataContentType ContentType = "multipart/form-data"
|
||||
|
||||
type notAuthorizedContentTypeError struct{}
|
||||
|
||||
const notAuthorizedContentTypeErrorMessage = "accepted value for 'Content-Type': %s"
|
||||
|
||||
func (e *notAuthorizedContentTypeError) Error() string {
|
||||
return fmt.Sprintf("Accepted value for 'Content-Type': %s", MultipartFormDataContentType)
|
||||
return fmt.Sprintf(notAuthorizedContentTypeErrorMessage, MultipartFormDataContentType)
|
||||
}
|
||||
|
||||
// CheckAuthorizedContentType checks if the request header header has an authorized content type.
|
||||
|
||||
@@ -31,7 +31,8 @@ func TestCheckAuthorizedContentType(t *testing.T) {
|
||||
|
||||
func TestNotAuthorizedContentTypeError(t *testing.T) {
|
||||
err := ¬AuthorizedContentTypeError{}
|
||||
expected := fmt.Sprintf("Accepted value for 'Content-Type': %s", MultipartFormDataContentType)
|
||||
expected := fmt.Sprintf(notAuthorizedContentTypeErrorMessage, MultipartFormDataContentType)
|
||||
|
||||
if err.Error() != expected {
|
||||
t.Errorf("Error returned a wrong message: got '%s' want '%s'", err.Error(), expected)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user