HTTP.negotiateHttpStatus()

Trigger a specific exit based on the provided HTTP status code.

Usage

Hover over inputs/exits for more info.

var HTTP = require('machinepack-http');


// Trigger a specific exit based on the provided HTTP status code.

HTTP.negotiateHttpStatus({

statusCode: 403,

}).execSync();

Inputs

statusCode required

The status code to negotiate.

403

Exits

error

An unexpected error occurred.

redirect

A 3xx status code was returned.

badRequest

400 status code was returned.

unauthorized

401 status code was returned.

forbidden

403 status code was returned.

notFound

404 status code was returned.

otherClientError

A 4xx status code other than 400, 401, 403 or 404 was returned.

serverError

5xx status code was returned.

other

An unusual / unsupported status code was returned.

success

OK.