membrane / api-gateway

API gateway for REST, OpenAPI, GraphQL and SOAP written in Java.
https://membrane-api.io
Apache License 2.0
457 stars 137 forks source link

OpenAPI Validator: reduce log output #1036

Closed rrayst closed 4 months ago

rrayst commented 5 months ago

If OpenAPI validation is configured and no content-type header is being sent, a whole stack trace is logged:

jakarta.mail.internet.ParseException: In Content-Type string <null>, expected MIME type, got null
  at jakarta.mail.internet.ContentType .<init>(ContentType.java:70) ~[jakarta.mail-api-2.1.3.jar:?]
  at com.predic8.membrane.core.openapi.model.Message.mediaType(Message. java: 86) ~[service-proxy-core-5.4.1.jar:5.4.1]
  at com.predic8.membrane.core.openapi.util.Utils.getopenapivalidatorResponse(Utils.java: 165) ~[service-proxy-core-5.4.1.jar:5.4.1]
  at com.predic8.membrane.core.openapi.serviceproxy.OpenAPIInterceptor.validateResponse(OpenAPIInterceptor.java:127) ~[service-proxy-core-5.4.1.jar:5.4.1]
  at com.predic8.membrane.core.openapi.serviceproxy.OpenAPIInterceptor.handleResponse(OpenAPIInterceptor.java:96) ~[service-proxy-core-5.4.1.jar:5.4.1]
  at com.predic8.membrane.core.interceptor.InterceptorFlowController.invokeResponseHandlers(InterceptorFlowController.java:131) ~[service-proxy-core-5.4.1.jar:5.4.1]

Please reduce this to a single log line No Content-Type header found in request..

predic8 commented 4 months ago

Done for 204. For other it is an error an then the stacktrace is fine