davinci_pdex_test_kit 0.10.2 → 0.10.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07b20c46020a10992818e90e951939d60ca6127d0a9e82b3ccd8592c96d6f47c
4
- data.tar.gz: 8b8c85a170b4bc89f38c427f303a4e76a256ef467c71226afa6dc14886a01be5
3
+ metadata.gz: 5c6a95e37547466e4863cad1b71f6e9adf175a9f3ed2732484e60b10580f1567
4
+ data.tar.gz: 5da2b0a0f27588a2458fef38d5eb2b67dcb5c2b0ee6951e09aebc9da33ffe84e
5
5
  SHA512:
6
- metadata.gz: 9dfd5abebf80197b094355572ca218624b4d05be33697bf97701c727d6957eb3881e204608a30f13f4a6240e8b5abcb141c7c2efbe9a8bbae362f2c795c5a8c6
7
- data.tar.gz: d74a854a763402112e7628657a2f206822f02fb95d413ec79365576527217a2b3b3e35cfc031300ddb45a3b4b25e93388816622990afa35d2a29ec6a34ecbe45
6
+ metadata.gz: c70ba56df1b20578b054154642aa1afb33d5522c60316fe3f675480528ff6221f2f3b6f29ea211dac93b85eec7337f3d909a01839f53bcde1fe61a70d6bd5e17
7
+ data.tar.gz: 6b8829941a6aee4949fa6d54fd19bbc93289918582abd843b1419f6db228d4bcd3cfc492e39694dedd99b01cfc57ae67d4808c894752ec7eb73946821050de65
@@ -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}
@@ -23,7 +23,8 @@ module DaVinciPDexTestKit
23
23
  * $export-poll-status: `#{export_status_url}`, then continue to make reads from the binaries if a payload is delivered
24
24
 
25
25
  and [click here](#{resume_clinical_data_url}?token=#{access_token}) when done.
26
- )
26
+ ),
27
+ timeout: 900
27
28
  )
28
29
  end
29
30
  end
@@ -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.4'
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.4
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-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: inferno_core