mrmike / Ok2Curl

Convert OkHttp requests into curl logs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recognize Basic Authorization

mgawinec opened this issue · comments

In case request contains Authorization header of Basic type, e.g.,

Authorizaton: Basic bWFjaWVrOnRham5laGFzbG8xMjM=

would it be possible to have the following

curl -u maciej:tajnehaslo123 ...

?

Hi @mgawinec

I think I can add this feature in the next version. Thanks for the suggestion :)

Hi @mgawinec

There's a support for HeaderModifiers in the latest version. You can read more here: https://github.com/mrmike/Ok2Curl#header-modifiers

Simply you have to create HeaderModifier and add it to CurlInterceptor. I've added sample Header that is decoding basic Auth header. So you can copy it and use it in your project.

If you have any questions just let me know.

Thanks. Unfortunately, this is solution just transforms one header into another, e.g.

Authorization: bWFjaWVqOnNlY3JldA==

will be transformed into

Authorization: maciej:secret

While I was expecting something that will transform an original header into curl command parameter, e.g.:

-u maciej:secret

Hi @mgawinec

Sure I will try to add it as well. I hope this solution will work for you for a while.