blueprint_agreement 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/blueprint_agreement/api_services/drakov_service.rb +1 -1
- data/lib/blueprint_agreement/request_builder.rb +22 -3
- data/lib/blueprint_agreement/version.rb +1 -1
- data/test/fixtures/hello_api.md +17 -0
- data/test/integration/simple_api_test.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e5a1e036ac9271954e3c96329a28c2d4c86cb747
|
|
4
|
+
data.tar.gz: 910db3562b5e51afd8afda394510bcb4b42ec0b7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 992d8e4b3b696bc0b3ddf582b0c21b8a1305aa54a99d58c45961c2f8c3881b9ba532515e2a0a0b38fb9afe4fcd1af08f145a593649c78ee3d3e4b0fac511c286
|
|
7
|
+
data.tar.gz: 828c36905e2a2e3901cdcf58770bf902162c9679fec3303c7248c3291d7945996de51172cfd3c5cc5abe93599227fa5ded28811e32f0531875e79e1e5116db13
|
data/README.md
CHANGED
|
@@ -61,6 +61,15 @@ module BlueprintAgreement
|
|
|
61
61
|
"HTTP_COOKIE" => "Cookie",
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
DEFAULT_HEADERS = %w[
|
|
65
|
+
HTTP_ACCEPT HTTP_ACCEPT_CHARSET HTTP_ACCEPT_ENCODING
|
|
66
|
+
HTTP_ACCEPT_LANGUAGE HTTP_CACHE_CONTROL HTTP_FROM
|
|
67
|
+
HTTP_NEGOTIATE HTTP_PRAGMA HTTP_CLIENT_IP
|
|
68
|
+
HTTP_X_FORWARDED_FOR HTTP_ORIGIN HTTP_VERSION
|
|
69
|
+
HTTP_X_CSRF_TOKEN HTTP_X_REQUEST_ID HTTP_X_FORWARDED_HOST
|
|
70
|
+
SERVER_ADDR
|
|
71
|
+
].freeze
|
|
72
|
+
|
|
64
73
|
def initialize(context)
|
|
65
74
|
@context = context
|
|
66
75
|
end
|
|
@@ -82,11 +91,21 @@ module BlueprintAgreement
|
|
|
82
91
|
end
|
|
83
92
|
|
|
84
93
|
def headers
|
|
85
|
-
|
|
94
|
+
headers = {}
|
|
95
|
+
|
|
96
|
+
DEFAULT_HEADERS.each do |env|
|
|
97
|
+
next unless @context.request.env.key?(env)
|
|
98
|
+
key = env.sub(/^HTTP_/n, '').downcase
|
|
99
|
+
headers[key] = @context.request.env[env]
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
HEADER_PATCH.each do |header|
|
|
86
103
|
header_name, key = header
|
|
87
104
|
next unless @context.request.env.key?(header_name)
|
|
88
|
-
|
|
89
|
-
end
|
|
105
|
+
headers[key] = @context.request.env[header_name]
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
headers.compact
|
|
90
109
|
end
|
|
91
110
|
|
|
92
111
|
def request
|
data/test/fixtures/hello_api.md
CHANGED
|
@@ -64,3 +64,20 @@ API Blueprint** and as such you can **parse** it with the
|
|
|
64
64
|
{
|
|
65
65
|
"cookie": "have a cookie!"
|
|
66
66
|
}
|
|
67
|
+
|
|
68
|
+
# GET /extra_headers
|
|
69
|
+
+ Request (application/json)
|
|
70
|
+
|
|
71
|
+
+ Headers
|
|
72
|
+
|
|
73
|
+
Cookie: cookie=have-a-cookie
|
|
74
|
+
Accept: application/json
|
|
75
|
+
Version: v1
|
|
76
|
+
|
|
77
|
+
+ Response 200 (application/json)
|
|
78
|
+
|
|
79
|
+
+ Body
|
|
80
|
+
|
|
81
|
+
{
|
|
82
|
+
"cookie": "have a cookie!"
|
|
83
|
+
}
|
|
@@ -26,6 +26,22 @@ describe "Rails" do
|
|
|
26
26
|
last_response.shall_agree_upon('hello_api.md')
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
|
+
|
|
30
|
+
describe 'extra_headers' do
|
|
31
|
+
let(:env) do
|
|
32
|
+
{
|
|
33
|
+
'HTTP_COOKIE' => 'cookie=have-a-cookie',
|
|
34
|
+
'CONTENT_TYPE' => 'application/json',
|
|
35
|
+
'HTTP_ACCEPT' => 'application/json',
|
|
36
|
+
'HTTP_VERSION' => 'v1'
|
|
37
|
+
}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
let(:endpoint) { '/extra_headers' }
|
|
41
|
+
it 'returns a valid request' do
|
|
42
|
+
last_response.shall_agree_upon('hello_api.md')
|
|
43
|
+
end
|
|
44
|
+
end
|
|
29
45
|
end
|
|
30
46
|
|
|
31
47
|
describe "Rack Test" do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: blueprint_agreement
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Charly Palencia
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-01-
|
|
11
|
+
date: 2017-01-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|