bitjwt 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/bitjwt/protocol.rb +2 -1
- data/lib/bitjwt/version.rb +1 -1
- data/spec/lib/protocol_spec.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cee38d4ab2a9fa1c8343f9acbf1cc703fa4c2f1
|
4
|
+
data.tar.gz: c3ae203e301c0bc4776ea7d1ae6ce23a246f3448
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cfd6980159e0427a6e32adb5b9d4ee32944afb4b39568cbadd51b3c33e839a2be81cb8ff6809a7b2fbac133fcf5f0a7668435f254c97f7e52aaee187e939185
|
7
|
+
data.tar.gz: 23f219ce582b1ddc306790616b4fd2f67b38f4273d181d09598258afc288cb573fd9d17460bb590b5ee0c34def6f01061b042033b65196d493fce77e4393b0f9
|
data/Gemfile.lock
CHANGED
data/lib/bitjwt/protocol.rb
CHANGED
@@ -36,7 +36,7 @@ module BitJWT
|
|
36
36
|
@signature ||= crypto.sign(header_payload_encoded)
|
37
37
|
end
|
38
38
|
|
39
|
-
def send(url, method)
|
39
|
+
def send(url, method, raw_response = false)
|
40
40
|
connection = Excon.new(url, omit_default_port: true)
|
41
41
|
response = connection.request(path: payload_to_h['aud'],
|
42
42
|
method: method,
|
@@ -46,6 +46,7 @@ module BitJWT
|
|
46
46
|
},
|
47
47
|
body: "#{header_payload_encoded}.#{signature_encoded}")
|
48
48
|
raise ProtocolError.new(response.status, response.body) unless (200..299).cover?(response.status)
|
49
|
+
return response.body if raw_response
|
49
50
|
build_response(response.body)
|
50
51
|
end
|
51
52
|
|
data/lib/bitjwt/version.rb
CHANGED
data/spec/lib/protocol_spec.rb
CHANGED
@@ -54,6 +54,12 @@ module BitJWT
|
|
54
54
|
expect(payload['data']).to eql JWTStub::PAYLOAD['data']
|
55
55
|
end
|
56
56
|
|
57
|
+
it 'receive a raw response' do
|
58
|
+
jwt_stub.valid_response
|
59
|
+
response = request.send(url, 'POST', true)
|
60
|
+
expect(response).to be_a(String)
|
61
|
+
end
|
62
|
+
|
57
63
|
it 'receive an invalid response (tampered payload)' do
|
58
64
|
jwt_stub.invalid_response
|
59
65
|
response = request.send(url, 'POST')
|