request(): Promise<YelixResponse>
Makes a request to the Yelix application and returns a typed response
Example 1
Example 1
// Simple GET request const response = await request(app, '/api/hello?name=world', { method: 'GET' }); // Assertions in tests expect(response.req.status).toBe(200); expect(response.res.responseType).toBe(ResponseType.TEXT); expect(response.res.text).toBe('Hello, world'); // POST request with body const response = await request(app, '/api/users', { method: 'POST', body: JSON.stringify({ name: 'John' }), headers: { 'Content-Type': 'application/json' } });
Promise resolving to YelixResponse