Skip to content

Commit 0ae42e0

Browse files
committed
Refactor json marshalling on JVM to match unmarshaller signature for consistency.
1 parent 32cce79 commit 0ae42e0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

http-api-client/src/jvmMain/kotlin/au/com/redcrew/apisdkcreator/httpclient/json-marshaller.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import kotlin.reflect.KClass
66
/**
77
* A factory function to aid in marshalling JSON data into a HttpRequest.
88
*/
9-
fun jsonMarshaller(contentType: String = JSON_MIME_TYPE): (Marshaller) -> HttpRequestPolicy<*, UnstructuredData> =
10-
marshallerFor(contentType)
9+
fun jsonMarshaller(marshaller: Marshaller, contentType: String = JSON_MIME_TYPE): HttpRequestPolicy<*, UnstructuredData> =
10+
marshallerFor(contentType)(marshaller)
1111

1212
/**
1313
* A factory function to aid in unmarshalling JSON data

http-api-client/src/jvmTest/kotlin/au/com/redcrew/apisdkcreator/httpclient/json-marshaller-test.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ class JsonMarshallingTest : DescribeSpec({
2727
val request = aHttpRequest<TestBody>().withBody(body).build()
2828

2929
suspend fun marshall(contentType: String): Either<SdkError, HttpRequest<UnstructuredData>> =
30-
jsonMarshaller(contentType)(marshaller)(request)
30+
jsonMarshaller(marshaller, contentType)(request)
3131

3232
suspend fun marshall(): Either<SdkError, HttpRequest<UnstructuredData>> =
33-
jsonMarshaller()(marshaller)(request)
33+
jsonMarshaller(marshaller)(request)
3434

3535
it("should set content type") {
3636
val contentType = "application/json+vnd"

0 commit comments

Comments
 (0)