@@ -91,19 +91,21 @@ default APIResponse delete(String url) {
9191 void dispose ();
9292 /**
9393 * Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
94- * context cookies from the response. The method will automatically follow redirects. JSON objects can be passed directly
95- * to the request.
94+ * context cookies from the response. The method will automatically follow redirects.
9695 *
9796 * <p> <strong>Usage</strong>
97+ *
98+ * <p> JSON objects can be passed directly to the request:
9899 * <pre>{@code
99100 * Map<String, Object> data = new HashMap();
100101 * data.put("title", "Book Title");
101102 * data.put("body", "John Doe");
102103 * request.fetch("https://example.com/api/createBook", RequestOptions.create().setMethod("post").setData(data));
103104 * }</pre>
104105 *
105- * <p> The common way to send file(s) in the body of a request is to encode it as form fields with {@code multipart/form-data}
106- * encoding. You can achieve that with Playwright API like this:
106+ * <p> The common way to send file(s) in the body of a request is to upload them as form fields with {@code
107+ * multipart/form-data} encoding. Use {@code FormData} to construct request body and pass it to the request as {@code
108+ * multipart} parameter:
107109 * <pre>{@code
108110 * // Pass file path to the form data constructor:
109111 * Path file = Paths.get("team.csv");
@@ -114,7 +116,7 @@ default APIResponse delete(String url) {
114116 * // Or you can pass the file content directly as FilePayload object:
115117 * FilePayload filePayload = new FilePayload("f.js", "text/javascript",
116118 * "console.log(2022);".getBytes(StandardCharsets.UTF_8));
117- * APIResponse response = request.fetch("https://example.com/api/uploadTeamList ",
119+ * APIResponse response = request.fetch("https://example.com/api/uploadScript ",
118120 * RequestOptions.create().setMethod("post").setMultipart(
119121 * FormData.create().set("fileField", filePayload)));
120122 * }</pre>
@@ -127,19 +129,21 @@ default APIResponse fetch(String urlOrRequest) {
127129 }
128130 /**
129131 * Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
130- * context cookies from the response. The method will automatically follow redirects. JSON objects can be passed directly
131- * to the request.
132+ * context cookies from the response. The method will automatically follow redirects.
132133 *
133134 * <p> <strong>Usage</strong>
135+ *
136+ * <p> JSON objects can be passed directly to the request:
134137 * <pre>{@code
135138 * Map<String, Object> data = new HashMap();
136139 * data.put("title", "Book Title");
137140 * data.put("body", "John Doe");
138141 * request.fetch("https://example.com/api/createBook", RequestOptions.create().setMethod("post").setData(data));
139142 * }</pre>
140143 *
141- * <p> The common way to send file(s) in the body of a request is to encode it as form fields with {@code multipart/form-data}
142- * encoding. You can achieve that with Playwright API like this:
144+ * <p> The common way to send file(s) in the body of a request is to upload them as form fields with {@code
145+ * multipart/form-data} encoding. Use {@code FormData} to construct request body and pass it to the request as {@code
146+ * multipart} parameter:
143147 * <pre>{@code
144148 * // Pass file path to the form data constructor:
145149 * Path file = Paths.get("team.csv");
@@ -150,7 +154,7 @@ default APIResponse fetch(String urlOrRequest) {
150154 * // Or you can pass the file content directly as FilePayload object:
151155 * FilePayload filePayload = new FilePayload("f.js", "text/javascript",
152156 * "console.log(2022);".getBytes(StandardCharsets.UTF_8));
153- * APIResponse response = request.fetch("https://example.com/api/uploadTeamList ",
157+ * APIResponse response = request.fetch("https://example.com/api/uploadScript ",
154158 * RequestOptions.create().setMethod("post").setMultipart(
155159 * FormData.create().set("fileField", filePayload)));
156160 * }</pre>
@@ -162,19 +166,21 @@ default APIResponse fetch(String urlOrRequest) {
162166 APIResponse fetch (String urlOrRequest , RequestOptions params );
163167 /**
164168 * Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
165- * context cookies from the response. The method will automatically follow redirects. JSON objects can be passed directly
166- * to the request.
169+ * context cookies from the response. The method will automatically follow redirects.
167170 *
168171 * <p> <strong>Usage</strong>
172+ *
173+ * <p> JSON objects can be passed directly to the request:
169174 * <pre>{@code
170175 * Map<String, Object> data = new HashMap();
171176 * data.put("title", "Book Title");
172177 * data.put("body", "John Doe");
173178 * request.fetch("https://example.com/api/createBook", RequestOptions.create().setMethod("post").setData(data));
174179 * }</pre>
175180 *
176- * <p> The common way to send file(s) in the body of a request is to encode it as form fields with {@code multipart/form-data}
177- * encoding. You can achieve that with Playwright API like this:
181+ * <p> The common way to send file(s) in the body of a request is to upload them as form fields with {@code
182+ * multipart/form-data} encoding. Use {@code FormData} to construct request body and pass it to the request as {@code
183+ * multipart} parameter:
178184 * <pre>{@code
179185 * // Pass file path to the form data constructor:
180186 * Path file = Paths.get("team.csv");
@@ -185,7 +191,7 @@ default APIResponse fetch(String urlOrRequest) {
185191 * // Or you can pass the file content directly as FilePayload object:
186192 * FilePayload filePayload = new FilePayload("f.js", "text/javascript",
187193 * "console.log(2022);".getBytes(StandardCharsets.UTF_8));
188- * APIResponse response = request.fetch("https://example.com/api/uploadTeamList ",
194+ * APIResponse response = request.fetch("https://example.com/api/uploadScript ",
189195 * RequestOptions.create().setMethod("post").setMultipart(
190196 * FormData.create().set("fileField", filePayload)));
191197 * }</pre>
@@ -198,19 +204,21 @@ default APIResponse fetch(Request urlOrRequest) {
198204 }
199205 /**
200206 * Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update
201- * context cookies from the response. The method will automatically follow redirects. JSON objects can be passed directly
202- * to the request.
207+ * context cookies from the response. The method will automatically follow redirects.
203208 *
204209 * <p> <strong>Usage</strong>
210+ *
211+ * <p> JSON objects can be passed directly to the request:
205212 * <pre>{@code
206213 * Map<String, Object> data = new HashMap();
207214 * data.put("title", "Book Title");
208215 * data.put("body", "John Doe");
209216 * request.fetch("https://example.com/api/createBook", RequestOptions.create().setMethod("post").setData(data));
210217 * }</pre>
211218 *
212- * <p> The common way to send file(s) in the body of a request is to encode it as form fields with {@code multipart/form-data}
213- * encoding. You can achieve that with Playwright API like this:
219+ * <p> The common way to send file(s) in the body of a request is to upload them as form fields with {@code
220+ * multipart/form-data} encoding. Use {@code FormData} to construct request body and pass it to the request as {@code
221+ * multipart} parameter:
214222 * <pre>{@code
215223 * // Pass file path to the form data constructor:
216224 * Path file = Paths.get("team.csv");
@@ -221,7 +229,7 @@ default APIResponse fetch(Request urlOrRequest) {
221229 * // Or you can pass the file content directly as FilePayload object:
222230 * FilePayload filePayload = new FilePayload("f.js", "text/javascript",
223231 * "console.log(2022);".getBytes(StandardCharsets.UTF_8));
224- * APIResponse response = request.fetch("https://example.com/api/uploadTeamList ",
232+ * APIResponse response = request.fetch("https://example.com/api/uploadScript ",
225233 * RequestOptions.create().setMethod("post").setMultipart(
226234 * FormData.create().set("fileField", filePayload)));
227235 * }</pre>
@@ -337,7 +345,8 @@ default APIResponse patch(String url) {
337345 * }</pre>
338346 *
339347 * <p> The common way to send file(s) in the body of a request is to upload them as form fields with {@code
340- * multipart/form-data} encoding. You can achieve that with Playwright API like this:
348+ * multipart/form-data} encoding. Use {@code FormData} to construct request body and pass it to the request as {@code
349+ * multipart} parameter:
341350 * <pre>{@code
342351 * // Pass file path to the form data constructor:
343352 * Path file = Paths.get("team.csv");
@@ -346,9 +355,9 @@ default APIResponse patch(String url) {
346355 * FormData.create().set("fileField", file)));
347356 *
348357 * // Or you can pass the file content directly as FilePayload object:
349- * FilePayload filePayload = new FilePayload("f .js", "text/javascript",
358+ * FilePayload filePayload1 = new FilePayload("f1 .js", "text/javascript",
350359 * "console.log(2022);".getBytes(StandardCharsets.UTF_8));
351- * APIResponse response = request.post("https://example.com/api/uploadTeamList ",
360+ * APIResponse response = request.post("https://example.com/api/uploadScript ",
352361 * RequestOptions.create().setMultipart(
353362 * FormData.create().set("fileField", filePayload)));
354363 * }</pre>
@@ -384,7 +393,8 @@ default APIResponse post(String url) {
384393 * }</pre>
385394 *
386395 * <p> The common way to send file(s) in the body of a request is to upload them as form fields with {@code
387- * multipart/form-data} encoding. You can achieve that with Playwright API like this:
396+ * multipart/form-data} encoding. Use {@code FormData} to construct request body and pass it to the request as {@code
397+ * multipart} parameter:
388398 * <pre>{@code
389399 * // Pass file path to the form data constructor:
390400 * Path file = Paths.get("team.csv");
@@ -393,9 +403,9 @@ default APIResponse post(String url) {
393403 * FormData.create().set("fileField", file)));
394404 *
395405 * // Or you can pass the file content directly as FilePayload object:
396- * FilePayload filePayload = new FilePayload("f .js", "text/javascript",
406+ * FilePayload filePayload1 = new FilePayload("f1 .js", "text/javascript",
397407 * "console.log(2022);".getBytes(StandardCharsets.UTF_8));
398- * APIResponse response = request.post("https://example.com/api/uploadTeamList ",
408+ * APIResponse response = request.post("https://example.com/api/uploadScript ",
399409 * RequestOptions.create().setMultipart(
400410 * FormData.create().set("fileField", filePayload)));
401411 * }</pre>
0 commit comments