microsoft_kiota_faraday 0.13.0 → 0.15.0

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: '096cf34a1aab4023bb227673cd84dbd9a1152c72b9407de32fab9c99b40a7803'
4
- data.tar.gz: 4a91e57d27ec77fe746097e6d767651cf31616158f52c7879141f900e769a874
3
+ metadata.gz: 8283ab45d952dd9ce09297255b84aff4d12f4c39131bde1fbac9ac51eb9d4edc
4
+ data.tar.gz: 9a4c91de3e7246d077057f46d3783f994c4d5cb80bef6d00452b3d426d27f494
5
5
  SHA512:
6
- metadata.gz: 41b0d3f42b1c1e037ee29ccd268d96b1383945bfd6edfb7fa349256b19e19c0f94ad53123e870e8e8e2e364046399f5450c09bf6e1bbd2b61f2a9a80c4fa4e52
7
- data.tar.gz: eec7751e973ff50341c83ed20b592ca1b457f5cbfb339648937906de3d5b7fcf42f817144dd890a9cbb7d445a76ef0d3cc6c3f1eda8c3063d54d9a60a55c9c16
6
+ metadata.gz: 8ca8d5fb301de24bcb8780612961fee732a232dd6737867071598f2ef01abb54c556dc2185ca420f332e1fe6028508f7e4780b23ddb9e003b50deac6a0bbd783
7
+ data.tar.gz: 5f0e91186db4a5172033e98eea8fb0e4ede997a5025f0474e7435d106a967f8f64320949ce784deeb3d174fa7f9483f677712d789469588726e2ed01c78784db
data/CHANGELOG.md CHANGED
@@ -11,6 +11,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11
11
 
12
12
  ### Changed
13
13
 
14
+ ## [0.15.0] - 2024-02-16
15
+
16
+ ### Changed
17
+
18
+ - Ensure get_parse_node does not fail when response body is empty. [#27](https://github.com/microsoft/kiota-http-ruby/pull/28)
19
+
20
+ ## [0.14.0] - 2024-02-14
21
+
22
+ ### Changed
23
+
24
+ - Make sure the base_url is set when calling authenticate_request. [#27](https://github.com/microsoft/kiota-http-ruby/pull/27)
25
+
14
26
  ## [0.13.0] - 2024-02-05
15
27
 
16
28
  ### Changed
@@ -9,7 +9,7 @@ module MicrosoftKiotaFaraday
9
9
  include MicrosoftKiotaAbstractions::RequestAdapter
10
10
 
11
11
  attr_accessor :authentication_provider, :content_type_header_key, :parse_node_factory, :serialization_writer_factory, :client
12
-
12
+
13
13
  def initialize(authentication_provider, parse_node_factory=MicrosoftKiotaAbstractions::ParseNodeFactoryRegistry.default_instance, serialization_writer_factory=MicrosoftKiotaAbstractions::SerializationWriterFactoryRegistry.default_instance, client = KiotaClientFactory::get_default_http_client)
14
14
 
15
15
  if !authentication_provider
@@ -21,7 +21,7 @@ module MicrosoftKiotaFaraday
21
21
  if @parse_node_factory.nil?
22
22
  @parse_node_factory = MicrosoftKiotaAbstractions::ParseNodeFactoryRegistry.default_instance
23
23
  end
24
- @serialization_writer_factory = serialization_writer_factory
24
+ @serialization_writer_factory = serialization_writer_factory
25
25
  if @serialization_writer_factory.nil?
26
26
  @serialization_writer_factory = MicrosoftKiotaAbstractions::SerializationWriterFactoryRegistry.default_instance
27
27
  end
@@ -49,6 +49,7 @@ module MicrosoftKiotaFaraday
49
49
  raise StandardError, 'factory cannot be null' unless factory
50
50
 
51
51
  Fiber.new do
52
+ set_base_url_for_request_information(request_info)
52
53
  @authentication_provider.authenticate_request(request_info).resume
53
54
  request = self.get_request_from_request_info(request_info)
54
55
  response = @client.run_request(request.http_method, request.path, request.body, request.headers)
@@ -70,6 +71,7 @@ module MicrosoftKiotaFaraday
70
71
  raise StandardError, 'response cannot be null' unless response
71
72
  response_content_type = self.get_response_content_type(response);
72
73
  raise StandardError, 'no response content type found for deserialization' unless response_content_type
74
+ return if response.body.nil? || response.body.empty?
73
75
  return @parse_node_factory.get_parse_node(response_content_type, response.body)
74
76
  end
75
77
 
@@ -92,7 +94,7 @@ module MicrosoftKiotaFaraday
92
94
  end
93
95
 
94
96
  def get_request_from_request_info(request_info)
95
- request_info.path_parameters['baseurl'] = @base_url
97
+ set_base_url_for_request_information(request_info)
96
98
  case request_info.http_method
97
99
  when :GET
98
100
  request = @client.build_request(:get)
@@ -118,7 +120,7 @@ module MicrosoftKiotaFaraday
118
120
  request.path = request_info.uri
119
121
  unless request_info.headers.nil? then
120
122
  request.headers = Faraday::Utils::Headers.new
121
- request_info.headers.get_all.select{|k,v|
123
+ request_info.headers.get_all.select{|k,v|
122
124
  if v.kind_of? Array then
123
125
  request.headers[k] = v.join(',')
124
126
  elsif v.kind_of? String then
@@ -151,10 +153,16 @@ module MicrosoftKiotaFaraday
151
153
  def convert_to_native_request_async(request_info)
152
154
  raise StandardError, 'request_info cannot be null' unless request_info
153
155
  return Fiber.new do
156
+ set_base_url_for_request_information(request_info)
154
157
  @authentication_provider.authenticate_request(request_info).resume
155
158
  return self.get_request_from_request_info(request_info)
156
159
  end
157
160
  end
158
161
 
162
+ private
163
+
164
+ def set_base_url_for_request_information(request_info)
165
+ request_info.path_parameters['baseurl'] = @base_url
166
+ end
159
167
  end
160
168
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MicrosoftKiotaFaraday
4
- VERSION = '0.13.0'
4
+ VERSION = '0.15.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: microsoft_kiota_faraday
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Microsoft Corporation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-05 00:00:00.000000000 Z
11
+ date: 2024-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: microsoft_kiota_abstractions