File: use_the_content-disposition_metadata.rst

package info (click to toggle)
swift 2.35.1-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 22,760 kB
  • sloc: python: 281,901; javascript: 1,059; sh: 619; pascal: 295; makefile: 81; xml: 32
file content (31 lines) | stat: -rw-r--r-- 1,207 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
====================================
Use the Content-Disposition metadata
====================================

To override the default behavior for a browser, use the
``Content-Disposition`` header to specify the override behavior and
assign this header to an object. For example, this header might specify
that the browser use a download program to save this file rather than
show the file, which is the default.

**Example Override browser default behavior request: HTTP**

This example assigns an attachment type to the ``Content-Disposition``
header. This attachment type indicates that the file is to be downloaded
as ``goodbye.txt``:

.. code:: console

   # curl -i  $publicURL/marktwain/goodbye -X POST -H "X-Auth-Token: $token" -H "Content-Length: 14" -H "Content-Type: application/octet-stream" -H "Content-Disposition: attachment; filename=goodbye.txt"

.. code:: console

   HTTP/1.1 202 Accepted
   Content-Length: 76
   Content-Type: text/html; charset=UTF-8
   X-Trans-Id: txa9b5e57d7f354d7ea9f57-0052e17e13
   X-Openstack-Request-Id: txa9b5e57d7f354d7ea9f57-0052e17e13
   Date: Thu, 23 Jan 2014 20:39:47 GMT

   <html><h1>Accepted</h1><p>The request is accepted for processing.</p></html>