Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

Commit 1bb2f79

Browse files
* Fixing deserialization error with the OpenAPI Generator
1 parent 657feab commit 1bb2f79

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

lib/mcapi/encryption/openapi_interceptor.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,10 @@ def hook_deserialize(enc)
7070
client.define_singleton_method(:deserialize) do |response, return_type|
7171
if response&.body
7272
endpoint = response.request.base_url.sub client.config.base_url, ''
73-
if enc.instance_of? McAPI::Encryption::FieldLevelEncryption
74-
to_decrypt = { headers: McAPI::Utils.parse_header(response.options[:response_headers]),
75-
request: { url: endpoint },
76-
body: JSON.parse(response.body) }
77-
else
78-
to_decrypt = { request: { url: endpoint },
79-
body: JSON.parse(response.body) }
80-
end
73+
to_decrypt = { headers: McAPI::Utils.parse_header(response.options[:response_headers]),
74+
request: { url: endpoint },
75+
body: JSON.parse(response.body) }
76+
8177
decrypted = enc.decrypt(JSON.generate(to_decrypt, symbolize_names: false))
8278
body = JSON.generate(JSON.parse(decrypted)['body'])
8379
response.options[:response_body] = JSON.generate(JSON.parse(body))

0 commit comments

Comments
 (0)