aboutsummaryrefslogtreecommitdiff
path: root/files/pt-br/web/api
diff options
context:
space:
mode:
authorMDN <actions@users.noreply.github.com>2021-07-01 00:37:12 +0000
committerMDN <actions@users.noreply.github.com>2021-07-01 00:37:12 +0000
commitb0a393384aa4021c915e6a650c75ff328a054cb2 (patch)
tree5f049f0db1c3b87c9d8ea12564cf7bc43b0e8f07 /files/pt-br/web/api
parent3f2eea0abf998516fe98d64da8da53a03d36c3ee (diff)
downloadtranslated-content-b0a393384aa4021c915e6a650c75ff328a054cb2.tar.gz
translated-content-b0a393384aa4021c915e6a650c75ff328a054cb2.tar.bz2
translated-content-b0a393384aa4021c915e6a650c75ff328a054cb2.zip
[CRON] sync translated content
Diffstat (limited to 'files/pt-br/web/api')
-rw-r--r--files/pt-br/web/api/body/index.html97
-rw-r--r--files/pt-br/web/api/body/json/index.html89
2 files changed, 0 insertions, 186 deletions
diff --git a/files/pt-br/web/api/body/index.html b/files/pt-br/web/api/body/index.html
deleted file mode 100644
index 121e93718b..0000000000
--- a/files/pt-br/web/api/body/index.html
+++ /dev/null
@@ -1,97 +0,0 @@
----
-title: Body
-slug: Web/API/Body
-tags:
- - API
- - BODY
- - Experimental
- - Fetch
- - Fetch API
- - Interface
- - NeedsTranslation
- - Reference
- - TopicStub
- - request
-translation_of: Web/API/Body
----
-<div>{{ APIRef("Fetch") }}</div>
-
-<p><span class="seoSummary">The <strong><code>Body</code></strong> {{glossary("mixin")}} of the <a href="/en-US/docs/Web/API/Fetch_API">Fetch API</a> represents the body of the response/request, allowing you to declare what its content type is and how it should be handled.</span></p>
-
-<p><code>Body</code> is implemented by both {{domxref("Request")}} and {{domxref("Response")}}. This provides these objects with an associated <dfn>body</dfn> (a <a href="/en-US/docs/Web/API/Streams_API">stream</a>), a <dfn>used flag</dfn> (initially unset), and a <dfn>MIME type</dfn> (initially the empty byte sequence).</p>
-
-<h2 id="Properties">Properties</h2>
-
-<dl>
- <dt>{{domxref("Body.body")}} {{readonlyInline}}</dt>
- <dd>A simple getter used to expose a {{domxref("ReadableStream")}} of the body contents.</dd>
- <dt>{{domxref("Body.bodyUsed")}} {{readonlyInline}}</dt>
- <dd>A {{jsxref("Boolean")}} that indicates whether the body has been read.</dd>
-</dl>
-
-<h2 id="Methods">Methods</h2>
-
-<dl>
- <dt>{{domxref("Body.arrayBuffer()")}}</dt>
- <dd>Takes a {{domxref("Response")}} stream and reads it to completion. It returns a promise that resolves with an {{jsxref("ArrayBuffer")}}.</dd>
- <dt>{{domxref("Body.blob()")}}</dt>
- <dd>Takes a {{domxref("Response")}} stream and reads it to completion. It returns a promise that resolves with a {{domxref("Blob")}}.</dd>
- <dt>{{domxref("Body.formData()")}}</dt>
- <dd>Takes a {{domxref("Response")}} stream and reads it to completion. It returns a promise that resolves with a {{domxref("FormData")}} object.</dd>
- <dt>{{domxref("Body.json()")}}</dt>
- <dd>Takes a {{domxref("Response")}} stream and reads it to completion. It returns a promise that resolves with the result of parsing the body text as {{jsxref("JSON")}}.</dd>
- <dt>{{domxref("Body.text()")}}</dt>
- <dd>Takes a {{domxref("Response")}} stream and reads it to completion. It returns a promise that resolves with a {{domxref("USVString")}} (text). The response is <em>always</em> decoded using UTF-8.</dd>
-</dl>
-
-<h2 id="Examples">Examples</h2>
-
-<p>The example below uses a simple fetch call to grab an image and display it in an {{htmlelement("img")}} tag. You'll notice that since we are requesting an image, we need to run {{domxref("Body.blob","Body.blob()")}} ({{domxref("Response")}} implements body) to give the response its correct MIME type.</p>
-
-<h3 id="HTML_Content">HTML Content</h3>
-
-<pre class="brush: html notranslate">&lt;img class="my-image" src="https://wikipedia.org/static/images/project-logos/frwiki-1.5x.png"&gt;
-</pre>
-
-<h3 id="JS_Content">JS Content</h3>
-
-<pre class="brush: js notranslate">const myImage = document.querySelector('.my-image');
-fetch('https://upload.wikimedia.org/wikipedia/commons/7/77/Delete_key1.jpg')
- .then(res =&gt; res.blob())
- .then(res =&gt; {
- const objectURL = URL.createObjectURL(res);
- myImage.src = objectURL;
-});</pre>
-
-<p>{{ EmbedLiveSample('Examples', '100%', '250px') }}</p>
-
-<h2 id="Specifications">Specifications</h2>
-
-<table class="standard-table">
- <tbody>
- <tr>
- <th scope="col">Specification</th>
- <th scope="col">Status</th>
- <th scope="col">Comment</th>
- </tr>
- <tr>
- <td>{{SpecName('Fetch','#body-mixin','Body')}}</td>
- <td>{{Spec2('Fetch')}}</td>
- <td></td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="Browser_compatibility">Browser compatibility</h2>
-
-
-
-<p>{{Compat("api.Body")}}</p>
-
-<h2 id="See_also">See also</h2>
-
-<ul>
- <li><a href="/en-US/docs/Web/API/ServiceWorker_API">ServiceWorker API</a></li>
- <li><a href="/en-US/docs/Web/HTTP/CORS">HTTP access control (CORS)</a></li>
- <li><a href="/en-US/docs/Web/HTTP">HTTP</a></li>
-</ul>
diff --git a/files/pt-br/web/api/body/json/index.html b/files/pt-br/web/api/body/json/index.html
deleted file mode 100644
index 7ee4482fe5..0000000000
--- a/files/pt-br/web/api/body/json/index.html
+++ /dev/null
@@ -1,89 +0,0 @@
----
-title: Body.json()
-slug: Web/API/Body/json
-tags:
- - API
- - Experimental
- - Fetch
- - JSON
- - Referencia
-translation_of: Web/API/Body/json
----
-<div>{{APIRef("Fetch API")}}</div>
-
-<p>O método <strong><code>json()</code></strong>  do mixin {{DOMxRef("Body")}} usa uma stream do objeto {{DOMxRef("Response")}} para tratar. O método <strong>json() </strong>retorna uma Promise como resultado do processamento da stream, retornando um objeto {{JSxRef("JSON")}} em caso de sucesso.</p>
-
-<h2 id="Syntaxe">Syntaxe</h2>
-
-<pre class="syntaxbox notranslate"><em>response</em>.json().then(<em>data</em> =&gt; {
- // do something with your data
-});</pre>
-
-<h3 id="Parâmetros">Parâmetros</h3>
-
-<p>Nenhum.</p>
-
-<h3 id="Retorno">Retorno</h3>
-
-<p>Uma {{jsxref("Promise")}} que retorna um objeto Javascript no método <strong>resolve()</strong>. Pode ser qualquer tipo que pode ser representado com JSON — objeto, array, string, numeral...</p>
-
-<h2 id="Exemplo">Exemplo</h2>
-
-<p>Em nosso <a href="https://github.com/mdn/fetch-examples/tree/master/fetch-json">exemplo de fetch em json</a> (teste <a href="http://mdn.github.io/fetch-examples/fetch-json/">aqui a busca em json com fetch</a>), nós criamos uma nova requisição usando o constructor de {{DOMxRef("Request.Request", "Request()")}}, e em seguimos a usamos para buscar um arquivo <code>.json</code>. Quando o fetch é bem-sucedido, nós lemos e tratamos a stream com o método <code>json()</code>, lê os valores em forma de objeto retornados como esperado e inserimos na lista para exibir os dados dos produtos.</p>
-
-<pre class="brush: js highlight[5] notranslate">const myList = document.querySelector('ul');
-const myRequest = new Request('products.json');
-
-fetch(myRequest)
- .then(response =&gt; response.json())
- .then(data =&gt; {
- for (const product of data.products) {
- let listItem = document.createElement('li');
- listItem.appendChild(
- document.createElement('strong')
- ).textContent = product.Name;
- listItem.append(
- ` can be found in ${
- product.Location
- }. Cost: `
- );
- listItem.appendChild(
- document.createElement('strong')
- ).textContent = `£${product.Price}`;
- myList.appendChild(listItem);
- }
- })
- .catch(console.error);</pre>
-
-<h2 id="Especificações">Especificações</h2>
-
-<table class="standard-table">
- <thead>
- <tr>
- <th scope="col">Specificações</th>
- <th scope="col">Status</th>
- <th scope="col">Comentários</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>{{SpecName("Fetch", "#dom-body-json", "Body.json()")}}</td>
- <td>{{Spec2("Fetch")}}</td>
- <td>Definição Inicial</td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="Compatibilidade_de_Navegador">Compatibilidade de Navegador</h2>
-
-
-
-<p>{{Compat("api.Body.json")}}</p>
-
-<h2 id="Veja_também">Veja também</h2>
-
-<ul>
- <li><a href="/en-US/docs/Web/API/ServiceWorker_API">ServiceWorker API</a></li>
- <li><a href="/en-US/docs/Web/HTTP/CORS">Cross-Origin Resource Sharing (CORS)</a></li>
- <li><a href="/en-US/docs/Web/HTTP">HTTP</a></li>
-</ul>