Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Invalid characters (CR/LF) in response header caused by customized Jackson ObjectMapper #123

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
package io.github.wimdeblauwe.htmx.spring.boot.thymeleaf;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.json.JsonMapper;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;

@AutoConfiguration
@ConditionalOnWebApplication
public class HtmxThymeleafAutoConfiguration {

@Bean
public HtmxDialect htmxDialect(ObjectMapper mapper) {
return new HtmxDialect(mapper);
public HtmxDialect htmxDialect() {
return new HtmxDialect(JsonMapper.builder().build());
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.github.wimdeblauwe.htmx.spring.boot.mvc;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.json.JsonMapper;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.AutoConfiguration;
Expand All @@ -26,14 +27,13 @@ public class HtmxMvcAutoConfiguration implements WebMvcRegistrations, WebMvcConf
private final ObjectMapper objectMapper;

HtmxMvcAutoConfiguration(@Qualifier("viewResolver") ObjectFactory<ViewResolver> resolver,
ObjectFactory<LocaleResolver> locales,
ObjectMapper objectMapper) {
ObjectFactory<LocaleResolver> locales) {
Assert.notNull(resolver, "ViewResolver must not be null!");
Assert.notNull(locales, "LocaleResolver must not be null!");

this.resolver = resolver;
this.locales = locales;
this.objectMapper = objectMapper;
this.objectMapper = JsonMapper.builder().build();
wimdeblauwe marked this conversation as resolved.
Show resolved Hide resolved
}

@Override
Expand Down