Skip to content

Commit ee13aff

Browse files
committed
Set Accept header based on registered Serializers even when injecting an OkHttpClient
1 parent 4248206 commit ee13aff

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

typedrest/src/main/kotlin/net/typedrest/endpoints/EntryEndpoint.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ open class EntryEndpoint : AbstractEndpoint {
2929
serializers: List<Serializer>,
3030
errorHandler: ErrorHandler = DefaultErrorHandler(),
3131
linkExtractor: LinkExtractor = AggregateLinkExtractor(HeaderLinkExtractor(), HalLinkExtractor())
32-
) : super(uri.ensureTrailingSlash(), httpClient, serializers, errorHandler, linkExtractor)
32+
) : super(uri.ensureTrailingSlash(), httpClient.withAccept(serializers.flatMap { it.supportedMediaTypes }.distinct()), serializers, errorHandler, linkExtractor)
3333

3434
/**
3535
* Creates a new entry endpoint.
@@ -47,7 +47,7 @@ open class EntryEndpoint : AbstractEndpoint {
4747
serializer: Serializer = KotlinxJsonSerializer(),
4848
errorHandler: ErrorHandler = DefaultErrorHandler(),
4949
linkExtractor: LinkExtractor = AggregateLinkExtractor(HeaderLinkExtractor(), HalLinkExtractor())
50-
) : super(uri.ensureTrailingSlash(), httpClient, listOf(serializer), errorHandler, linkExtractor)
50+
) : super(uri.ensureTrailingSlash(), httpClient.withAccept(serializer.supportedMediaTypes), listOf(serializer), errorHandler, linkExtractor)
5151

5252
/**
5353
* Creates a new entry endpoint.

0 commit comments

Comments
 (0)