Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response Header Parameter #37

Open
michael8bit opened this issue Mar 29, 2022 · 1 comment
Open

Response Header Parameter #37

michael8bit opened this issue Mar 29, 2022 · 1 comment

Comments

@michael8bit
Copy link

Hello, I would like to implement a post api that returns a custom header param in the header.
I have seen that the sendAsync function returns the response text and status code.

let sendAsync (method: HttpMethod) (basePath: string) (path: string) (extraHeaders: Header list) (parts: RequestPart list) : Async<int * string> =
    async {
        let requestPath = applyPathParts path parts
        let requestPathWithQuery = applyQueryStringParameters requestPath parts
        let fullPath = combineBasePath basePath requestPathWithQuery
        let! response =
            Http.request fullPath
            |> Http.method method
            |> applyJsonRequestBody parts
            |> applyMultipartFormData parts
            |> applyUrlEncodedFormData parts
            |> Http.headers extraHeaders
            |> Http.withCredentials true
            |> Http.send

        let status = response.statusCode
        let content = response.responseText
        return status, content
    }

Is there currently a way to access the response header? Or does the library need to be extended?

@Zaid-Ajaj
Copy link
Owner

Hi @michael8bit, unfortunately response headers are not part of the output. The library would have to be extended in order to support response headers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants