Skip to content

Commit

Permalink
Properly rename file and add another extension function
Browse files Browse the repository at this point in the history
  • Loading branch information
dewantawsif committed Feb 5, 2025
1 parent a080543 commit 80e02e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ val result = secondApi.getCommentsById("3") {
Then you can use the extension function to set additional configuration. The RequestBuilder will be applied last after everything that is set by Ktorfit

## Annotations
Function annotations are available in the request object with their respective values via the `annotation` extension (`HttpRequestBuilder.annotations`)
Function annotations are available in the request object with their respective values via the `annotation` extension (`HttpRequest.annotations` or `HttpRequestBuilder.annotations`)

Do note that `OptIn` annotation is not included in the returned list

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package de.jensklingenberg.ktorfit

import io.ktor.client.request.HttpRequest
import io.ktor.client.request.HttpRequestBuilder
import io.ktor.util.AttributeKey

public val annotationsAttributeKey: AttributeKey<List<Any>> = AttributeKey("__ktorfit_attribute_annotations")

public val HttpRequest.annotations: List<Any>
inline get() = attributes.getOrNull(annotationsAttributeKey) ?: emptyList()

public val HttpRequestBuilder.annotations: List<Any>
get() = attributes.getOrNull(annotationsAttributeKey) ?: emptyList()
inline get() = attributes.getOrNull(annotationsAttributeKey) ?: emptyList()

0 comments on commit 80e02e7

Please sign in to comment.