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

formdata/methods

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

FormData.create() method

FormData.create() is a Java-specific method available since v1.18 that creates a new instance of FormData and returns a FormData object.

FormData.set() method

FormData.set() is available since v1.18 and sets a field on the form. It accepts two parameters: name (string) and value (string, boolean, int, path, or FilePayload object with name, mimeType, and buffer properties). It returns a FormData object. If the specified key already exists, set() will overwrite all existing values with the new one.

FormData.append() method

FormData.append() is available since v1.44 and appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist. It accepts two parameters: name (string) and value (string, boolean, int, path, or FilePayload object with name, mimeType, and buffer properties). It returns a FormData object. Multiple fields with the same name can be added. The difference from set() is that append() adds the new value onto the end of the existing set of values rather than overwriting.

FormData set() example with simple and file values

Example showing FormData.set() usage in Java: FormData form = FormData.create().set("firstName", "John").set("profilePicture1", Paths.get("john.jpg")).set("profilePicture2", new FilePayload("john.jpg", "image/jpeg", Files.readAllBytes(Paths.get("john.jpg")))).set("age", 30); page.request().post("http://localhost/submit", RequestOptions.create().setForm(form));

FormData append() example with simple and file values

Example showing FormData.append() usage in Java: FormData form = FormData.create().append("firstName", "John").append("attachment", Paths.get("pic.jpg")).append("attachment", new FilePayload("table.csv", "text/csv", Files.readAllBytes(Paths.get("my-tble.csv")))); page.request().post("http://localhost/submit", RequestOptions.create().setForm(form));

FormData set() Python example

Example showing FormData.set() usage in Python (async and sync): form = FormData(); form.set("firstName", "John"); form.set("profilePicture1", Path("john.jpg")); form.set("profilePicture2", {"name": "john.jpg", "mimeType": "image/jpeg", "buffer": Path("john.jpg").read_bytes()}); form.set("age", 30); await page.request.post("http://localhost/submit", multipart=form) or page.request.post("http://localhost/submit", multipart=form)

FormData append() Python example

Example showing FormData.append() usage in Python (async and sync): form = FormData(); form.append("firstName", "John"); form.append("attachment", Path("pic.jpg")); form.append("attachment", {"name": "table.csv", "mimeType": "text/csv", "buffer": Path("my-table.csv").read_bytes()}); await page.request.post("http://localhost/submit", multipart=form) or page.request.post("http://localhost/submit", multipart=form)

Give your agent this brain