Skip to content

mvt:call - Pass Custom HTTP Credentials Headers#


Description#

This shows an example of how to pass custom headers using mvt:call. Each header must end with crlf.

Snippet#

<mvt:assign name="l.header_break" value="asciichar(13) $ asciichar(10)" />

<mvt:assign name="l.basic_auth:username" value="'super'" />
<mvt:assign name="l.basic_auth:password" value="'secret'" />
<mvt:assign name="l.basic_auth:base64_encoded" value="crypto_base64_encode(l.basic_auth:username $ ':' $ l.basic_auth:password)" />
<mvt:assign name="l.basic_auth:header" value="'Authorization: Basic ' $ l.basic_auth:base64_encoded $ l.header_break" />

<mvt:call action="'https://www.example.com/admin/'" method="'GET'" headers="l.basic_auth:header">
    <mvt:eval expr="s.callvalue" />
</mvt:call>

Functions Used#

  • mvt:call