A project is typically developed by multiple partners working together toward a specific target. The interdependence among the various stakeholders often restricts individual members during the process, and misunderstandings may adversely influence the development process or even impact the project timing. Mock can be used early in the project development cycle to simulate activities and project results. This can greatly reduce miscommunication and misunderstanding among team members in the project development and greatly improve the development efficiency.
API Gateway supports simple configuration in Mock mode.
Click API Edition > Basic Backend Definitions to configure the Mock.
You can enter the actual response result in the Mock response result field. Currently, the system supports Mock response results in JSON, XML, and text formats. For example:
:title":"Mock test for API Gateway
Save the Mock configuration and release it to the testing or production environment for debugging based on your needs. You can also debug on the API debugging page.
The following table lists the valid values of statusCode. Format and status of HTTP 1.1 response status codes are supported. If you specify a statusCode that is not listed in the following table, the system reports an error indicating that the parameter is invalid.
|http code||http message|
|405||Method Not Allowed|
|407||Proxy Authentication Required|
|413||Request Entity Too Large|
|414||Request-URI Too Long|
|415||Unsupported Media Type|
|416||Requested Range Not Satisfiable|
|451||Method Connect Exception|
|500||Internal Server Error|
|505||HTTP Version Not Supported|
API Gateway supports custom Mock headers and duplicate header names. The value of a header name cannot be empty and may only contain numbers, letters, underscores (_), and hyphens (-). The value of a header cannot be empty.
To remove a Mock, configure a different backend service. The value of the Mock response result is not removed and you can use the value for the next Mock setting. You need to release the change. A change takes effect only after being released.