darrenburns / posting

The modern API client that lives in your terminal.
Apache License 2.0
4.48k stars 64 forks source link

Variable interpolation for authentication not working as expected #81

Closed rost314 closed 4 weeks ago

rost314 commented 1 month ago

Hi,

First of all, thank you for this super cool project—it's been really helpful!

I wanted to report an issue related to environment variable interpolation for authentication.

I tried to figure out, how it is supposed to work. Inside the send_request function in app.py:

  1. The uninterpolated authentication is fetched from the form like this:

    auth = self.request_auth.to_httpx_auth()
  2. This is then passed to the httpx.AsyncClient constructor.

  3. Later, the interpolation is done on the RequestModel inside:

    request = self.build_httpx_request(
        request_options, client, apply_template=True
    )

This includes the interpolation of the authentication variable. However, the authentication is only part of the RequestModel and does not get transferred to the request or the client.

As a result, the request is sent with the uninterpolated authentication stored in the client, leading to an unauthorized response.

Could you please take a look at this? I'm happy to provide more details if needed.

Thanks again for your effort on this project!

Best regards,
Robert

RStreitfeld commented 4 weeks ago

Thanks for fixing this with version 1.11.0 so quickly. I can confirm, that it works as expected now.

darrenburns commented 4 weeks ago

@RStreitfeld sorry, meant to update this. Glad it's working now and thanks for the report.