new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Playwright · API reference · all subjects

requestoptions

5 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

RequestOptions class overview

The RequestOptions class allows creating form data to be sent via APIRequestContext. Playwright automatically determines the content type of the request. It was introduced in v1.18 and is available for Java.

Example: POST request with query parameter and data

context.request().post( "https://example.com/submit", RequestOptions.create() .setQueryParam("page", 1) .setData("My data"));

Example: POST request with form data using application/x-www-form-urlencoded

context.request().post("https://example.com/signup", RequestOptions.create().setForm( FormData.create() .set("firstName", "John") .set("lastName", "Doe")));

Example: POST request with file upload using multipart/form-data with Path

Path path = Paths.get("members.csv"); APIResponse response = context.request().post("https://example.com/upload_members", RequestOptions.create().setMultipart(FormData.create().set("membersList", path)));

Example: POST request with file upload using multipart/form-data with FilePayload

FilePayload filePayload = new FilePayload("members.csv", "text/csv", "Alice, 33\nJohn, 35\n".getBytes(StandardCharsets.UTF_8)); APIResponse response = context.request().post("https://example.com/upload_members", RequestOptions.create().setMultipart(FormData.create().set("membersList", filePayload)));

Give your agent this brain