docs(api): auth endpoints in bruno
This commit is contained in:
35
LogisticsSupportTool_API_DOCS/app/auth/Session.bru
Normal file
35
LogisticsSupportTool_API_DOCS/app/auth/Session.bru
Normal file
@@ -0,0 +1,35 @@
|
||||
meta {
|
||||
name: Session
|
||||
type: http
|
||||
seq: 5
|
||||
}
|
||||
|
||||
get {
|
||||
url: http://{{url}}/lst/api/auth/get-session
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"username": "matthes01",
|
||||
"password": "nova0511"
|
||||
}
|
||||
}
|
||||
|
||||
script:post-response {
|
||||
// grab the raw Set-Cookie header
|
||||
const cookies = res.headers["set-cookie"];
|
||||
|
||||
// cookies is usually an array, e.g. ["auth_session=abcd123; Path=/; HttpOnly; Secure; SameSite=Lax"]
|
||||
|
||||
// Extract just the value part ("auth_session=abcd123")
|
||||
const sessionCookie = cookies[0].split(";")[0];
|
||||
|
||||
// Save it as an environment variable
|
||||
bru.setEnvVar("session_cookie", sessionCookie);
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
}
|
||||
Reference in New Issue
Block a user