Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added API server context. #27

Merged
merged 1 commit into from
Jan 16, 2025
Merged

Added API server context. #27

merged 1 commit into from
Jan 16, 2025

Conversation

AlexSkrypnyk
Copy link
Member

@AlexSkrypnyk AlexSkrypnyk commented Jan 16, 2025

/**
 * API test server to return queued responses to HTTP requests.
 *
 * The requests and responses can be enqueued via `/admin/*` endpoints.
 *
 * Supported endpoints:
 * - GET `/admin/status`: Check the server status.
 *   > HTTP/1.1 200 OK
 *   > X-Received-Requests: 0
 *   > X-Queued-Responses: 0
 *
 * - GET `/admin/requests`: Get the received requests.
 *   > HTTP/1.1 200 OK
 *   > X-Received-Requests: 1
 *   > X-Queued-Responses: 0
 *   > Content-Type: application/json
 *   > [{'http_method': 'GET', 'uri': '/', 'headers': {}, 'body': 'string'}]
 *
 * - DELETE `/admin/requests`: Delete all received requests.
 *   > HTTP/1.1 200 OK
 *   > X-Received-Requests: 0
 *   > X-Queued-Responses: 0
 *
 * - GET `/admin/responses`: Get the queued responses.
 *   > HTTP/1.1 200 OK
 *   > X-Received-Requests: 0
 *   > X-Queued-Responses: 1
 *   > Content-Type: application/json
 *   > [{'status': 200, 'reason': 'OK', 'headers': {}, 'body': '' }]
 *
 * - DELETE `/admin/responses`: Delete all queued responses.
 *   > HTTP/1.1 200 OK
 *   > X-Received-Requests: 0
 *   > X-Queued-Responses: 0
 *
 * - PUT `/admin/responses`: Enqueue responses.
 *   > HTTP/1.1 201 Created
 *   > X-Received-Requests: 0
 *   > X-Queued-Responses: 1
 *   > Content-Type: application/json
 *   > [{'status': 200, 'reason': 'OK', 'headers': {}, 'body': '' }, {'status': 404, 'reason': 'Not found', 'headers': {}, 'body': '' }]
 *
 * This class is intended to be lightweight and limited in functionality.
 *
 * @phpcs:disable Drupal.Classes.ClassFileName.NoMatch
 */

@AlexSkrypnyk AlexSkrypnyk enabled auto-merge (rebase) January 16, 2025 11:51
@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/api-server branch 2 times, most recently from 7aaa88d to ff554ee Compare January 16, 2025 21:49
@AlexSkrypnyk AlexSkrypnyk disabled auto-merge January 16, 2025 21:49
@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/api-server branch 2 times, most recently from d1488fc to 89395df Compare January 16, 2025 23:19
@AlexSkrypnyk AlexSkrypnyk merged commit 1db02e3 into main Jan 16, 2025
3 checks passed
@AlexSkrypnyk AlexSkrypnyk deleted the feature/api-server branch January 16, 2025 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant