Skip to content

Instantly share code, notes, and snippets.

@clayg
Created August 30, 2016 00:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clayg/c414c632c7ec10aff8f3db6bb042740b to your computer and use it in GitHub Desktop.
Save clayg/c414c632c7ec10aff8f3db6bb042740b to your computer and use it in GitHub Desktop.
# Create a container
vagrant@saio:~$ curl -H 'x-auth-token: AUTH_tk048e71a1a3474003a73fd70799f48368' "http://saio:8080/v1/AUTH_test/Linda" -XPUT
# Upload an object with a space in the name
vagrant@saio:~$ curl -H 'x-auth-token: AUTH_tk048e71a1a3474003a73fd70799f48368' "http://saio:8080/v1/AUTH_test/Linda/non-matching%20records.csv" -XPUT -d test
# Validate the object name has a space in it according to the listing
vagrant@saio:~$ curl -H 'x-auth-token: AUTH_tk048e71a1a3474003a73fd70799f48368' "http://saio:8080/v1/AUTH_test/Linda?format=json" -XGET | python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 194 100 194 0 0 9971 0 --:--:-- --:--:-- --:--:-- 10210
[
{
"bytes": 4,
"content_type": "application/x-www-form-urlencoded",
"hash": "098f6bcd4621d373cade4e832627b4f6",
"last_modified": "2016-08-30T00:08:34.713530",
"name": "non-matching records.csv"
}
]
# ... and you can download it if you quote the space
vagrant@saio:~$ curl -H 'x-auth-token: AUTH_tk048e71a1a3474003a73fd70799f48368' "http://saio:8080/v1/AUTH_test/Linda/non-matching%20records.csv" -v
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to saio (127.0.0.1) port 8080 (#0)
> GET /v1/AUTH_test/Linda/non-matching%20records.csv HTTP/1.1
> User-Agent: curl/7.35.0
> Host: saio:8080
> Accept: */*
> x-auth-token: AUTH_tk048e71a1a3474003a73fd70799f48368
>
< HTTP/1.1 200 OK
< Content-Length: 4
< Accept-Ranges: bytes
< Last-Modified: Tue, 30 Aug 2016 00:08:35 GMT
< Etag: 098f6bcd4621d373cade4e832627b4f6
< X-Timestamp: 1472515714.71353
< Content-Type: application/x-www-form-urlencoded
< X-Trans-Id: txa16c49f1610c43c09dd29-0057c4ceae
< Date: Tue, 30 Aug 2016 00:09:18 GMT
<
* Connection #0 to host saio left intact
testvagrant@saio:~$
# ... you *can* quote any forward slashes in the path as well, but obviously this is not needed
vagrant@saio:~$ curl -H 'x-auth-token: AUTH_tk048e71a1a3474003a73fd70799f48368' "http://saio:8080/v1%2FAUTH_test%2FLinda%2Fnon-matching%20records.csv" -v
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to saio (127.0.0.1) port 8080 (#0)
> GET /v1%2FAUTH_test%2FLinda%2Fnon-matching%20records.csv HTTP/1.1
> User-Agent: curl/7.35.0
> Host: saio:8080
> Accept: */*
> x-auth-token: AUTH_tk048e71a1a3474003a73fd70799f48368
>
< HTTP/1.1 200 OK
< Content-Length: 4
< Accept-Ranges: bytes
< Last-Modified: Tue, 30 Aug 2016 00:08:35 GMT
< Etag: 098f6bcd4621d373cade4e832627b4f6
< X-Timestamp: 1472515714.71353
< Content-Type: application/x-www-form-urlencoded
< X-Trans-Id: txb14c24bc2cd54d6480f3d-0057c4cf6b
< Date: Tue, 30 Aug 2016 00:12:27 GMT
<
* Connection #0 to host saio left intact
testvagrant@saio:~$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment