Skip to content

Instantly share code, notes, and snippets.

@bheyde
Created July 14, 2016 15:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bheyde/f4f6a1b39843ea0ace04e96eaf2cf4a1 to your computer and use it in GitHub Desktop.
Save bheyde/f4f6a1b39843ea0ace04e96eaf2cf4a1 to your computer and use it in GitHub Desktop.
mvt:call - passing custom headers example
<mvt:assign name="g.api_endpoint" value="'https://DJDHGSDJD-dsn.algolia.net'" />
<mvt:assign name="g.index_name" value="'docs.miva'" />
<mvt:assign name="g.path" value="'/1/indexes/' $ g.index_name $ '/390342730'" />
<mvt:assign name="g.api_request" value="g.api_endpoint $ g.path" />
<mvt:assign name="g.headers" value="'X-Algolia-API-Key: 17181817181912' $ asciichar( 13 ) $ asciichar( 10 )" />
<mvt:assign name="g.headers" value=" g.headers $ 'X-Algolia-Application-Id: HSGDJDJDGD' $ asciichar( 13 ) $ asciichar( 10 )" />
<mvt:call action="g.api_request" method="'PUT'" headers="'g.headers'">
<mvt:eval expr="s.callvalue" />
</mvt:call>
@andrew-serrano
Copy link

Hi Brennan, I just noticed that headers='g.headers' doesn't currently work for me but instead headers=g.headers does. Could this accidentally be a typo on the snippet provided? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment