Skip to content

Commit 24c454d

Browse files
authored
Merge ba9af62 into cfc5405
2 parents cfc5405 + ba9af62 commit 24c454d

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

sentry-spring-boot-jakarta/api/sentry-spring-boot-jakarta.api

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ public class io/sentry/spring/boot/jakarta/SentryLogbackAppenderAutoConfiguratio
1818
public fun sentryLogbackInitializer (Lio/sentry/spring/boot/jakarta/SentryProperties;)Lio/sentry/spring/boot/jakarta/SentryLogbackInitializer;
1919
}
2020

21+
public class io/sentry/spring/boot/jakarta/SentryLogbackInitializer : org/springframework/context/event/GenericApplicationListener {
22+
public fun <init> (Lio/sentry/spring/boot/jakarta/SentryProperties;)V
23+
public fun onApplicationEvent (Lorg/springframework/context/ApplicationEvent;)V
24+
public fun supportsEventType (Lorg/springframework/core/ResolvableType;)Z
25+
}
26+
2127
public class io/sentry/spring/boot/jakarta/SentryProperties : io/sentry/SentryOptions {
2228
public fun <init> ()V
2329
public fun getExceptionResolverOrder ()I

sentry-spring-boot/api/sentry-spring-boot.api

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ public class io/sentry/spring/boot/SentryLogbackAppenderAutoConfiguration {
1818
public fun sentryLogbackInitializer (Lio/sentry/spring/boot/SentryProperties;)Lio/sentry/spring/boot/SentryLogbackInitializer;
1919
}
2020

21+
public class io/sentry/spring/boot/SentryLogbackInitializer : org/springframework/context/event/GenericApplicationListener {
22+
public fun <init> (Lio/sentry/spring/boot/SentryProperties;)V
23+
public fun onApplicationEvent (Lorg/springframework/context/ApplicationEvent;)V
24+
public fun supportsEventType (Lorg/springframework/core/ResolvableType;)Z
25+
}
26+
2127
public class io/sentry/spring/boot/SentryProperties : io/sentry/SentryOptions {
2228
public fun <init> ()V
2329
public fun getExceptionResolverOrder ()I

sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/SentrySpringFilter.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,17 @@ private boolean qualifiesForCaching(
134134
return maxRequestBodySize != RequestSize.NONE
135135
&& contentLength != -1
136136
&& contentType != null
137-
&& MimeType.valueOf(contentType).isCompatibleWith(MediaType.APPLICATION_JSON)
137+
&& shouldCacheMimeType(contentType)
138138
&& ((maxRequestBodySize == SMALL && contentLength < 1000)
139139
|| (maxRequestBodySize == MEDIUM && contentLength < 10000)
140140
|| maxRequestBodySize == ALWAYS);
141141
}
142142

143+
private static boolean shouldCacheMimeType(String contentType) {
144+
return MimeType.valueOf(contentType).isCompatibleWith(MediaType.APPLICATION_JSON)
145+
|| MimeType.valueOf(contentType).isCompatibleWith(MediaType.APPLICATION_FORM_URLENCODED);
146+
}
147+
143148
static final class RequestBodyExtractingEventProcessor implements EventProcessor {
144149
private final @NotNull RequestPayloadExtractor requestPayloadExtractor =
145150
new RequestPayloadExtractor();

sentry-spring/src/main/java/io/sentry/spring/SentrySpringFilter.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,17 @@ private boolean qualifiesForCaching(
134134
return maxRequestBodySize != RequestSize.NONE
135135
&& contentLength != -1
136136
&& contentType != null
137-
&& MimeType.valueOf(contentType).isCompatibleWith(MediaType.APPLICATION_JSON)
137+
&& shouldCacheMimeType(contentType)
138138
&& ((maxRequestBodySize == SMALL && contentLength < 1000)
139139
|| (maxRequestBodySize == MEDIUM && contentLength < 10000)
140140
|| maxRequestBodySize == ALWAYS);
141141
}
142142

143+
private static boolean shouldCacheMimeType(String contentType) {
144+
return MimeType.valueOf(contentType).isCompatibleWith(MediaType.APPLICATION_JSON)
145+
|| MimeType.valueOf(contentType).isCompatibleWith(MediaType.APPLICATION_FORM_URLENCODED);
146+
}
147+
143148
static final class RequestBodyExtractingEventProcessor implements EventProcessor {
144149
private final @NotNull RequestPayloadExtractor requestPayloadExtractor =
145150
new RequestPayloadExtractor();

0 commit comments

Comments
 (0)