diff options
| author | Chris Lu <chris.lu@gmail.com> | 2018-07-18 02:37:09 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2018-07-18 02:37:09 -0700 |
| commit | 834a25f0840c0dfbf3b27006f419d7e2d5f25b90 (patch) | |
| tree | 33264c427d53dab4549201216c68bb0c6e2ad597 /weed/s3api/s3api_headers.go | |
| parent | 7abfab8e77275f97cbc04e048e7d6b6a5ab7b140 (diff) | |
| download | seaweedfs-834a25f0840c0dfbf3b27006f419d7e2d5f25b90.tar.xz seaweedfs-834a25f0840c0dfbf3b27006f419d7e2d5f25b90.zip | |
add list all my buckets
Diffstat (limited to 'weed/s3api/s3api_headers.go')
| -rw-r--r-- | weed/s3api/s3api_headers.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/weed/s3api/s3api_headers.go b/weed/s3api/s3api_headers.go new file mode 100644 index 000000000..ff9bfc2ed --- /dev/null +++ b/weed/s3api/s3api_headers.go @@ -0,0 +1,31 @@ +package s3api + +import ( + "bytes" + "encoding/xml" + "fmt" + "net/http" + "time" +) + +type mimeType string + +const ( + mimeNone mimeType = "" + mimeJSON mimeType = "application/json" + mimeXML mimeType = "application/xml" +) + +func setCommonHeaders(w http.ResponseWriter) { + w.Header().Set("x-amz-request-id", fmt.Sprintf("%d", time.Now().UnixNano())) + w.Header().Set("Accept-Ranges", "bytes") +} + +// Encodes the response headers into XML format. +func encodeResponse(response interface{}) []byte { + var bytesBuffer bytes.Buffer + bytesBuffer.WriteString(xml.Header) + e := xml.NewEncoder(&bytesBuffer) + e.Encode(response) + return bytesBuffer.Bytes() +} |
