JsonHttpClient

A @actions/http-client based Http client that uses kotlinx serialization Json parsing and adds Accept (always) and Content-Type (*Json methods) headers.

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
open suspend fun delete(url: String, headers: HeaderProvider): JsonHttpResponse
Link copied to clipboard
open suspend fun get(url: String, headers: HeaderProvider): JsonHttpResponse
Link copied to clipboard
open suspend fun head(url: String, headers: HeaderProvider): JsonHttpResponse
Link copied to clipboard
open suspend fun options(url: String, headers: HeaderProvider): JsonHttpResponse
Link copied to clipboard
open suspend fun patch(url: String, data: String, headers: HeaderProvider): JsonHttpResponse
open suspend fun patch(url: String, data: Flow<String>, headers: HeaderProvider): JsonHttpResponse
open suspend fun patch(url: String, data: Flow<Buffer>, headers: HeaderProvider): JsonHttpResponse
open suspend fun patch(url: String, data: ReadableStream, headers: HeaderProvider): JsonHttpResponse
Link copied to clipboard
inline suspend fun <T> patchJson(url: String, data: T, headers: HeaderProvider = HeaderProvider { }): JsonHttpResponse
inline suspend fun <T> patchJson(url: String, data: Flow<T>, headers: HeaderProvider = HeaderProvider { }): JsonHttpResponse
Link copied to clipboard
open suspend fun post(url: String, data: String, headers: HeaderProvider): JsonHttpResponse
open suspend fun post(url: String, data: Flow<String>, headers: HeaderProvider): JsonHttpResponse
open suspend fun post(url: String, data: Flow<Buffer>, headers: HeaderProvider): JsonHttpResponse
open suspend fun post(url: String, data: ReadableStream, headers: HeaderProvider): JsonHttpResponse
Link copied to clipboard
inline suspend fun <T> postJson(url: String, data: T, headers: HeaderProvider = HeaderProvider { }): JsonHttpResponse
inline suspend fun <T> postJson(url: String, data: Flow<T>, headers: HeaderProvider = HeaderProvider { }): JsonHttpResponse
Link copied to clipboard
open suspend fun put(url: String, data: String, headers: HeaderProvider): JsonHttpResponse
open suspend fun put(url: String, data: Flow<String>, headers: HeaderProvider): JsonHttpResponse
open suspend fun put(url: String, data: Flow<Buffer>, headers: HeaderProvider): JsonHttpResponse
open suspend fun put(url: String, data: ReadableStream, headers: HeaderProvider): JsonHttpResponse
Link copied to clipboard
inline suspend fun <T> putJson(url: String, data: T, headers: HeaderProvider = HeaderProvider { }): JsonHttpResponse
inline suspend fun <T> putJson(url: String, data: Flow<T>, headers: HeaderProvider = HeaderProvider { }): JsonHttpResponse
Link copied to clipboard
open suspend fun request(verb: String, url: String, data: Flow<String>, headers: HeaderProvider): JsonHttpResponse
open suspend fun request(verb: String, url: String, data: Flow<Buffer>, headers: HeaderProvider): JsonHttpResponse
open suspend override fun request(verb: String, url: String, data: String, headers: HeaderProvider): JsonHttpResponse
open suspend override fun request(verb: String, url: String, data: ReadableStream, headers: HeaderProvider): JsonHttpResponse
Link copied to clipboard
inline suspend fun <T> requestJson(verb: String, url: String, data: T, headers: HeaderProvider = HeaderProvider {}): JsonHttpResponse
inline suspend fun <T> requestJson(verb: String, url: String, data: Flow<T>, headers: HeaderProvider = HeaderProvider {}): JsonHttpResponse

Extensions

Link copied to clipboard
fun HttpClient.json(json: Json = Json): JsonHttpClient

Get a Http client with json support wrapping this client.