{
"dev": {
"appURL": "https://example-dev.com"
},
"qa": {
"appURL": "https://example-qa.com"
},
"live": {
"appURL": "https://example.com"
}
}
# Constant values
@usecase = REGISTRATION
### Registration
# this is pre javascript block executed before http request executed
< {%
const pepperVal = request.environment.get("someConfidentialEnvironmentSpecificValue")
const dateUtcIsoFormat = new Date().toISOString().split('T')[0];
const formattedEntityVal = pepperVal + ':' + dateUtcIsoFormat;
const hashedEntity = crypto.sha256().updateWithText(formattedEntityVal, 'UTF-8').digest().toBase64(true);
// Dynamically derived value added to request context and can be used in http request
request.variables.set("dynamicHashedEntity", hashedEntity)
%}
POST {{appURL}}
Content-Type: application/vnd.registration+json
{
"name": "My Name",
"emailAddress": "my-email-address@example.com",
"payload": "{\"signature\": \"{{hashedEntity}}\"}",
}
// this is post javascript block executed after http request executed
> {%
client.test("Request executed successfully", function () {
client.assert(response.status === 201, "Response failed");
client.global.set("emailToken", response.body.code)
});
%}