Skip to content

Instantly share code, notes, and snippets.

@amrography
Last active April 29, 2021 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amrography/baf6dca34128f02570d8515bfdf7a13a to your computer and use it in GitHub Desktop.
Save amrography/baf6dca34128f02570d8515bfdf7a13a to your computer and use it in GitHub Desktop.
Set cookie in postman pre-request for Laravel Nova #api

Postman pre-request snippet for Laravel Nova

Get XSRF token and set it to a cookie variable in postman for using later.

pm.sendRequest({
url: `http://localhost:8000/nova/login`,
method: "GET",
}, (error, response, { cookies }) => {
if (!error) {
pm.environment.set('xsrf-cookie', cookies.get('XSRF-TOKEN'))
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment