Skip to content

Latest commit

 

History

History
101 lines (50 loc) · 122 KB

File metadata and controls

101 lines (50 loc) · 122 KB

Endpoints Documented

  1. http-status-main

Sequence Diagram


Flow Name

http-status-main

High Level Summary

This integration exposes an HTTP API endpoint at /api/http-status/* to handle requests and return dynamic HTTP status codes. It supports customized status codes for both successful (default 200) and error (default 500) responses. The API also allows for custom HTTP headers in both success and error scenarios. In case of errors, the current payload is returned as the response body.

Flow Diagram

Schema and Input/Output Examples

Not an API flow. Cannot extract schema.

Detailed Steps

  • This integration implements an HTTP API endpoint that listens for requests at the path /api/http-status/*
  • The implementation uses an API router to direct incoming requests to appropriate handlers based on the request
  • The API supports dynamic HTTP status code handling in both success and error scenarios:
    • Success responses can have customized status codes (defaults to 200)
    • Error responses can have customized status codes (defaults to 500)
  • The integration includes support for custom HTTP headers in both success and error responses
  • Error responses return the current payload as the response body

Error Handling

Scenario Error Code Response Object/Log Message
Resource not found 404 {"message": "Resource not found"}

Mapping Table

Mapping table: Comments: HTTP status API request to HTTP status API response (mock various HTTP status codes as JSON)

Source Field isMandatory Target Field isMandatory Rules
vars.httpStatus Yes code No The 'code' field is populated with the value of the 'httpStatus' variable, which is expected to be a number. This field is included in the output only when the 'httpStatus' variable is not equal to 204.
vars.httpStatus Yes message No The 'message' field is determined by looking up the 'httpStatus' variable (converted to a string) in a predefined set of status messages. If the 'httpStatus' value is not found in this set, the message defaults to Unknown Status Code. This field is included in the output only when the 'httpStatus' variable is not equal to 204.

Comments: This mapping table describes the transformation of an HTTP status code into a structured JSON response. The transformation logic is conditional: if the input status code is 204, an empty JSON object is returned. For any other status code, a JSON object containing a 'code' field and a 'message' field is returned. The 'code' field directly reflects the input HTTP status code, while the 'message' field provides a human-readable description derived from a predefined mapping of status codes to messages. If a status code is not found in the predefined mapping, a default message Unknown Status Code is used.

Unit Test Scenarios

No tests found for this flow in the repository.

Logging

No loggers found in the provided flow code.


Security

  1. No security measures are implemented in the provided code.
  2. The HTTP listener is configured to accept connections on all network interfaces (0.0.0.0) on port 8081 without any authentication or authorization mechanisms.
  3. No encryption methods are being used for data transmission.

Constants

Environment Variable Value Description
All http-status-httpListenerConfig.host 0.0.0.0 Host address for the HTTP listener that receives API requests for the http-status API
All http-status-httpListenerConfig.port 8081 Port number for the HTTP listener that receives API requests for the http-status API
All http-status-config.api http-status.raml RAML file that defines the API specification for the http-status API
All http-status-config.outboundHeadersMapName outboundHeaders Variable name used to store outbound headers in the API responses
All http-status-config.httpStatusVarName httpStatus Variable name used to store HTTP status codes in the API responses