MCPcopy Create free account
hub / github.com/angular/dev-infra / formData

Function formData

github-actions/browserstack/set-browserstack-env.js:5815–5843  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5813 return consumeBody(this, parseJSONFromBytes, instance);
5814 },
5815 formData() {
5816 return consumeBody(this, (value) => {
5817 const mimeType = bodyMimeType(this);
5818 if (mimeType !== null) {
5819 switch (mimeType.essence) {
5820 case "multipart/form-data": {
5821 const parsed = multipartFormDataParser(value, mimeType);
5822 if (parsed === "failure") {
5823 throw new TypeError("Failed to parse body as FormData.");
5824 }
5825 const fd = new FormData();
5826 fd[kState] = parsed;
5827 return fd;
5828 }
5829 case "application/x-www-form-urlencoded": {
5830 const entries = new URLSearchParams(value.toString());
5831 const fd = new FormData();
5832 for (const [name, value2] of entries) {
5833 fd.append(name, value2);
5834 }
5835 return fd;
5836 }
5837 }
5838 }
5839 throw new TypeError(
5840 'Content-Type was not one of "multipart/form-data" or "application/x-www-form-urlencoded".'
5841 );
5842 }, instance);
5843 },
5844 bytes() {
5845 return consumeBody(this, (bytes) => {
5846 return new Uint8Array(bytes);

Callers

nothing calls this directly

Calls 5

consumeBodyFunction · 0.70
bodyMimeTypeFunction · 0.70
multipartFormDataParserFunction · 0.70
toStringMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected