2020import java .nio .file .Path ;
2121
2222/**
23- * This API is used for the Web API testing. You can use it to trigger API endpoints, configure micro-services, prepare
24- * environment or the service to your e2e test.
23+ * This API is used for the Web API testing. You can use it to trigger API endpoints, configure micro-services,
24+ * prepare environment or the service to your e2e test.
2525 *
2626 * <p> Each Playwright browser context has associated with it {@code APIRequestContext} instance which shares cookie storage with the
2727 * browser context and can be accessed via {@link BrowserContext#request BrowserContext.request()} or {@link Page#request
3636 * automatically update {@code BrowserContext} cookies and requests made from the page will pick them up. This means that if you
3737 * log in using this API, your e2e test will be logged in and vice versa.
3838 *
39- * <p> If you want API requests to not interfere with the browser cookies you should create a new {@code APIRequestContext} by
40- * calling {@link APIRequest#newContext APIRequest.newContext()}. Such {@code APIRequestContext} object will have its own
39+ * <p> If you want API requests to not interfere with the browser cookies you should create a new {@code APIRequestContext}
40+ * by calling {@link APIRequest#newContext APIRequest.newContext()}. Such {@code APIRequestContext} object will have its own
4141 * isolated cookie storage.
4242 */
4343public interface APIRequestContext {
@@ -83,10 +83,11 @@ default APIResponse delete(String url) {
8383 */
8484 void dispose ();
8585 /**
86- * Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
87- * context cookies from the response. The method will automatically follow redirects.
86+ * Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and
87+ * update context cookies from the response. The method will automatically follow redirects. JSON objects can be passed
88+ * directly to the request.
8889 *
89- * <p> JSON objects can be passed directly to the request:
90+ * <p> **Usage**
9091 * <pre>{@code
9192 * Map<String, Object> data = new HashMap();
9293 * data.put("title", "Book Title");
@@ -117,10 +118,11 @@ default APIResponse fetch(String urlOrRequest) {
117118 return fetch (urlOrRequest , null );
118119 }
119120 /**
120- * Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
121- * context cookies from the response. The method will automatically follow redirects.
121+ * Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and
122+ * update context cookies from the response. The method will automatically follow redirects. JSON objects can be passed
123+ * directly to the request.
122124 *
123- * <p> JSON objects can be passed directly to the request:
125+ * <p> **Usage**
124126 * <pre>{@code
125127 * Map<String, Object> data = new HashMap();
126128 * data.put("title", "Book Title");
@@ -150,10 +152,11 @@ default APIResponse fetch(String urlOrRequest) {
150152 */
151153 APIResponse fetch (String urlOrRequest , RequestOptions params );
152154 /**
153- * Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
154- * context cookies from the response. The method will automatically follow redirects.
155+ * Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and
156+ * update context cookies from the response. The method will automatically follow redirects. JSON objects can be passed
157+ * directly to the request.
155158 *
156- * <p> JSON objects can be passed directly to the request:
159+ * <p> **Usage**
157160 * <pre>{@code
158161 * Map<String, Object> data = new HashMap();
159162 * data.put("title", "Book Title");
@@ -184,10 +187,11 @@ default APIResponse fetch(Request urlOrRequest) {
184187 return fetch (urlOrRequest , null );
185188 }
186189 /**
187- * Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
188- * context cookies from the response. The method will automatically follow redirects.
190+ * Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and
191+ * update context cookies from the response. The method will automatically follow redirects. JSON objects can be passed
192+ * directly to the request.
189193 *
190- * <p> JSON objects can be passed directly to the request:
194+ * <p> **Usage**
191195 * <pre>{@code
192196 * Map<String, Object> data = new HashMap();
193197 * data.put("title", "Book Title");
@@ -221,6 +225,8 @@ default APIResponse fetch(Request urlOrRequest) {
221225 * response. The method will populate request cookies from the context and update context cookies from the response. The
222226 * method will automatically follow redirects.
223227 *
228+ * <p> **Usage**
229+ *
224230 * <p> Request parameters can be configured with {@code params} option, they will be serialized into the URL search parameters:
225231 * <pre>{@code
226232 * request.get("https://example.com/api/getText", RequestOptions.create()
@@ -238,6 +244,8 @@ default APIResponse get(String url) {
238244 * response. The method will populate request cookies from the context and update context cookies from the response. The
239245 * method will automatically follow redirects.
240246 *
247+ * <p> **Usage**
248+ *
241249 * <p> Request parameters can be configured with {@code params} option, they will be serialized into the URL search parameters:
242250 * <pre>{@code
243251 * request.get("https://example.com/api/getText", RequestOptions.create()
@@ -292,6 +300,8 @@ default APIResponse patch(String url) {
292300 * response. The method will populate request cookies from the context and update context cookies from the response. The
293301 * method will automatically follow redirects.
294302 *
303+ * <p> **Usage**
304+ *
295305 * <p> JSON objects can be passed directly to the request:
296306 * <pre>{@code
297307 * Map<String, Object> data = new HashMap();
@@ -335,6 +345,8 @@ default APIResponse post(String url) {
335345 * response. The method will populate request cookies from the context and update context cookies from the response. The
336346 * method will automatically follow redirects.
337347 *
348+ * <p> **Usage**
349+ *
338350 * <p> JSON objects can be passed directly to the request:
339351 * <pre>{@code
340352 * Map<String, Object> data = new HashMap();
0 commit comments