Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix http://github.com/fperrad/lua-Spore/issues/12

  • Loading branch information...
commit 574da2d197d9a5b918b1da32a40bae4e2b2f7165 1 parent 048a867
@fperrad authored
View
5 CHANGES
@@ -6,6 +6,11 @@ Revision history for lua-Spore
- use WADL document as Spore specification
LIMITATION: cross-references are not supported
- add wadl2spore utility
+ INCOMPATIBILITY (see http://github.com/fperrad/lua-Spore/issues/12)
+ cli:meth{ payload = '@filename' } is no longer supported,
+ and could be rewritten like this :
+ local slurp = require 'Spore.Protocols'.slurp
+ cli:meth{ payload = slurp'filename' }
0.2.1 Sun Sep 16 11:30:00 2012
- add middleware Auth.DataPublica
View
5 src/Spore/Middleware/Auth/AWS.lua
@@ -15,7 +15,6 @@ local crypto = require 'crypto'
local digest = crypto.digest or crypto.evp.digest
local hmac = crypto.hmac
local request = require 'Spore.Protocols'.request
-local slurp = require 'Spore.Protocols'.slurp
require 'Spore'.early_validate = false
_ENV = nil
@@ -86,10 +85,6 @@ function m:call (req)
local payload = spore.payload
if payload then
- if payload:sub(1, 1) == '@' then
- local fname = payload:sub(2)
- payload = slurp(fname)
- end
req.headers['content-length'] = payload:len()
req.headers['content-type'] = req.headers['content-type'] or 'application/x-www-form-urlencoded'
if spore.headers and spore.headers['Content-MD5'] == 'AWS' then
View
4 src/Spore/Protocols.lua
@@ -109,10 +109,6 @@ local function request (req)
local payload = spore.payload
if payload then
- if payload:sub(1, 1) == '@' then
- local fname = payload:sub(2)
- payload = slurp(fname)
- end
req.source = ltn12.source.string(payload)
req.headers['content-length'] = payload:len()
req.headers['content-type'] = req.headers['content-type'] or 'application/x-www-form-urlencoded'
View
6 test/03-wrap.t
@@ -30,7 +30,7 @@ is( env.spore.params.border, 'border' )
error_like( function () client:get_user_info{} end,
"payload is required for method get_user_info" )
-error_like( function () client:get_user_info{ payload = '@file' } end,
+error_like( function () client:get_user_info{ payload = 'opaque data' } end,
"user is required for method get_user_info" )
local res = client:get_user_info{ user = 'joe', payload = 'OPAQUE' }
@@ -41,7 +41,7 @@ local res = client:get_info{ user = 'joe' }
local env = res.request.env
is( env.spore.params.user, 'joe' )
-error_like( function () client:get_info{ payload = '@file' } end,
+error_like( function () client:get_info{ payload = 'opaque data' } end,
"payload is not expected for method get_info" )
error_like( function () client:get_info{ mode = 'raw' } end,
@@ -53,7 +53,7 @@ lives_ok( function () client:get_info{ mode = 'raw' } end )
Spore.errors = io.tmpfile()
status = 404
r, ex = pcall( function ()
- local res = client:get_user_info{ payload = '@file', user = 'john' }
+ local res = client:get_user_info{ payload = 'opaque data', user = 'john' }
end)
is( r, false, "exception" )
is( tostring(ex), "404 not expected", "404 not expected" )
View
4 test/05-http_request.t
@@ -11,11 +11,11 @@ require 'Spore.Protocols'.request = function (req) return response end -- mock
local client = Spore.new_from_spec './test/api.json'
-local res = client:get_user_info{ payload = '@file', user = 'john' }
+local res = client:get_user_info{ payload = 'opaque data', user = 'john' }
is( res, response, "without middleware" )
client:enable 'Format.JSON'
-local res = client:get_user_info{ payload = '@file', user = 'john' }
+local res = client:get_user_info{ payload = 'opaque data', user = 'john' }
is( res, response, "with middleware" )
client:enable 'UserAgent'
View
2  test/52-parameter_default.t
@@ -31,7 +31,7 @@ local r = client:get_info{ user = 'Joe', border = 1 }
is( r.request.env.spore.params.user, 'Joe' )
is( r.request.env.spore.params.border, 1 )
-local r = client:get_user_info{ payload = '@file' }
+local r = client:get_user_info{ payload = 'opaque data' }
is( r.request.env.spore.params.user, 'John' )
is( r.request.env.spore.params.border, 0 )
Please sign in to comment.
Something went wrong with that request. Please try again.