Skip to content

Commit

Permalink
Fix custom headers for RPC requests
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-tennert authored Sep 8, 2024
1 parent 825aa59 commit 24f87c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ suspend inline fun <reified T : Any> Postgrest.rpc(
count = requestBuilder.count,
urlParams = urlParams,
body = encodedParameters,
schema = requestBuilder.schema
schema = requestBuilder.schema,
headers = requestBuilder.headers.build()
)
return RestRequestExecutor.execute(postgrest = this, path = "rpc/$function", request = rpcRequest)
}
Expand All @@ -78,7 +79,8 @@ suspend inline fun Postgrest.rpc(
method = requestBuilder.method.httpMethod,
count = requestBuilder.count,
urlParams = requestBuilder.params.mapToFirstValue(),
schema = requestBuilder.schema
schema = requestBuilder.schema,
headers = requestBuilder.headers.build()
)
return RestRequestExecutor.execute(postgrest = this, path = "rpc/$function", request = rpcRequest)
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.jan.supabase.postgrest.request

import io.github.jan.supabase.postgrest.query.Count
import io.ktor.http.HttpMethod
import io.ktor.http.*

Check warning

Code scanning / detekt

Wildcard imports should be replaced with imports using fully qualified class names. Wildcard imports can lead to naming conflicts. A library update can introduce naming clashes with your classes which results in compilation errors. Warning

io.ktor.http.* is a wildcard import. Replace it with fully qualified imports.
import kotlinx.serialization.json.JsonElement

@PublishedApi
Expand All @@ -10,7 +10,8 @@ internal class RpcRequest(
val count: Count? = null,
override val urlParams: Map<String, String>,
override val body: JsonElement? = null,
override val schema: String = "public"
override val schema: String = "public",
override val headers: Headers
) : PostgrestRequest {

override val prefer = if (count != null) listOf("count=${count.identifier}") else listOf()
Expand Down

0 comments on commit 24f87c9

Please sign in to comment.