davinci_pdex_test_kit 0.10.2 → 0.10.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07b20c46020a10992818e90e951939d60ca6127d0a9e82b3ccd8592c96d6f47c
4
- data.tar.gz: 8b8c85a170b4bc89f38c427f303a4e76a256ef467c71226afa6dc14886a01be5
3
+ metadata.gz: ab2a6cb356ae224ab504194aba059499028cad59620924a1e241ce3fc6933837
4
+ data.tar.gz: da42ce6fe75cc1d5556a76608c7e0cf5d023a7ee7a2a32ddabda69556b6ce599
5
5
  SHA512:
6
- metadata.gz: 9dfd5abebf80197b094355572ca218624b4d05be33697bf97701c727d6957eb3881e204608a30f13f4a6240e8b5abcb141c7c2efbe9a8bbae362f2c795c5a8c6
7
- data.tar.gz: d74a854a763402112e7628657a2f206822f02fb95d413ec79365576527217a2b3b3e35cfc031300ddb45a3b4b25e93388816622990afa35d2a29ec6a34ecbe45
6
+ metadata.gz: 22c98f6d0797b6f4ae1869231aebf919d177f7f493649884dde1d23f13ecb383f37655a484f9b6e5be17f18d8d9182b978f1fe3fac4b07ff59a50ae8aa804b7c
7
+ data.tar.gz: 7babf6b49a3264283ae8b5a17d0b53b81599fc04b8ffc99fa3f07adf7c3de889f42889f81ab534a97afc21a76ed7434f6e17f384909e081353ada64a34faf789
@@ -18,7 +18,9 @@ module DaVinciPDexTestKit
18
18
  url: ENV.fetch('FHIR_REFERENCE_SERVER'),
19
19
  params: {},
20
20
  headers: {'Content-Type' => 'application/json', 'Authorization' => 'Bearer SAMPLE_TOKEN', 'Host' => ENV.fetch('HOST_HEADER')},
21
- )
21
+ ) do |proxy|
22
+ proxy.use FaradayMiddleware::Gzip
23
+ end
22
24
  end
23
25
 
24
26
  def token_response(request, _test = nil, _test_result = nil)
@@ -34,8 +36,9 @@ module DaVinciPDexTestKit
34
36
  response = server_proxy.get(endpoint, params)
35
37
  request.status = response.status
36
38
  response_resource = replace_bundle_urls(FHIR.from_contents(response.body))
37
- request.response_headers = response.headers.reject!{|key, value| key == "transfer-encoding"} # chunked causes problems for client
39
+ request.response_headers = remove_transfer_encoding_header(response.headers)
38
40
  request.response_body = response_resource.to_json
41
+ request.response_header("content-length").value = request.response_body.length
39
42
  else
40
43
  response = server_proxy.get('Patient', {_id: 999})
41
44
  response_resource = FHIR.from_contents(response.body)
@@ -49,14 +52,14 @@ module DaVinciPDexTestKit
49
52
  def read_next_page(request, test = nil, test_result = nil)
50
53
  response = server_proxy.get('', request.query_parameters)
51
54
  request.status = response.status
52
- request.response_headers = response.headers.reject!{|key, value| key == "transfer-encoding"}
55
+ request.response_headers = remove_transfer_encoding_header(response.headers)
53
56
  request.response_body = replace_bundle_urls(FHIR.from_contents(response.body)).to_json
54
57
  end
55
58
 
56
59
  def everything_response(request, test = nil, test_result = nil)
57
60
  response = server_proxy.get('Patient/999/$everything') #TODO: Change from static response
58
61
  request.status = response.status
59
- request.response_headers = response.headers.reject!{|key, value| key == "transfer-encoding"}
62
+ request.response_headers = remove_transfer_encoding_header(response.headers)
60
63
  request.response_body = replace_bundle_urls(FHIR.from_contents(response.body)).to_json
61
64
  end
62
65
 
@@ -80,7 +83,7 @@ module DaVinciPDexTestKit
80
83
  req.headers = headers_as_hash.merge(server_proxy.headers)
81
84
  end
82
85
  request.status = response.status
83
- request.response_headers = response.env.response_headers
86
+ request.response_headers = remove_transfer_encoding_header(response.env.response_headers)
84
87
  request.response_body = response.status.to_i == 200 ? replace_export_urls(JSON.parse(response.body)).to_json : response.body
85
88
  request.response_header("content-length").value = request.response_body.length
86
89
  end
@@ -128,6 +131,14 @@ module DaVinciPDexTestKit
128
131
  proc { [200, {'Content-Type' => 'application/fhir+json;charset=utf-8'}, [File.read("lib/davinci_pdex_test_kit/metadata/mock_capability_statement.json")]] }
129
132
  end
130
133
 
134
+ def remove_transfer_encoding_header(headers)
135
+ if !headers["transfer-encoding"].nil?
136
+ headers.reject!{|key, value| key == "transfer-encoding"}
137
+ else
138
+ headers
139
+ end
140
+ end
141
+
131
142
  def match_request_to_expectation(endpoint, params)
132
143
  matched_search = SEARCHES_BY_PRIORITY[endpoint.to_sym].find {|expectation| (params.keys.map{|key| key.to_s} & expectation).sort == expectation}
133
144
  # matched_search_without_patient = SEARCHES_BY_PRIORITY[endpoint.to_sym].find {|expectation| (params.keys.map{|key| key.to_s} << "patient" & expectation) == expectation}
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DaVinciPDexTestKit
4
- VERSION = '0.10.2'
4
+ VERSION = '0.10.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: davinci_pdex_test_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Naden
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-07-08 00:00:00.000000000 Z
13
+ date: 2024-07-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: inferno_core