ree_lib 1.0.46 → 1.0.47
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/Gemfile.lock +1 -1
- data/lib/ree_lib/packages/ree_http/package/ree_http/functions/build_request.rb +3 -5
- data/lib/ree_lib/packages/ree_http/schemas/ree_http/functions/build_request.schema.json +0 -8
- data/lib/ree_lib/packages/ree_http/spec/ree_http/functions/http_post_spec.rb +21 -0
- data/lib/ree_lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c74ce073851aa0f44a9d5ef2d7df9000bd595e1208300a257269cdec28de15e8
|
4
|
+
data.tar.gz: eb2cc59a1ae7da783c6950236288e7be4a5d6a1c42f5216fd0c7cac5728941bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ae3e653b7ee36a1ce7574cfe1ec091532420744b5b87e33aa121b4c01929ff989f5e5800414dc10a59e9752daf2e02bd6b51f656a6f449db2ee5c89a3242c72
|
7
|
+
data.tar.gz: 6a09a450be8d91aced2a457248e30b6c810ceb9857e391ccb73574e4ee546fc96345cc4dcc0ad3618c3304fe808b78ad45a1a8f69150d95625ce38bd86237151
|
data/Gemfile.lock
CHANGED
@@ -4,10 +4,8 @@ class ReeHttp::BuildRequest
|
|
4
4
|
include Ree::FnDSL
|
5
5
|
|
6
6
|
fn :build_request do
|
7
|
-
link :to_json, from: :ree_json
|
8
|
-
link :slice, from: :ree_hash
|
9
7
|
link :not_blank, from: :ree_object
|
10
|
-
|
8
|
+
link :to_json, from: :ree_json
|
11
9
|
link 'ree_http/constants', -> {
|
12
10
|
HTTPS & HTTP & HTTPS_PORT & HTTP_PORT & DEFAULT_FORCE_SSL
|
13
11
|
}
|
@@ -84,8 +82,8 @@ class ReeHttp::BuildRequest
|
|
84
82
|
|
85
83
|
unless opts[:body].nil?
|
86
84
|
request.body =
|
87
|
-
case
|
88
|
-
when Hash then to_json
|
85
|
+
case opts[:body]
|
86
|
+
when Hash then to_json(opts[:body])
|
89
87
|
when File then opts[:body].read
|
90
88
|
else
|
91
89
|
opts[:body]
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'webmock/rspec'
|
3
|
+
require "tempfile"
|
3
4
|
|
4
5
|
RSpec.describe :http_post do
|
5
6
|
link :http_post, from: :ree_http
|
@@ -70,6 +71,26 @@ RSpec.describe :http_post do
|
|
70
71
|
body: "abc"
|
71
72
|
)
|
72
73
|
|
74
|
+
http_post(
|
75
|
+
host,
|
76
|
+
body: { foo: "bar" }
|
77
|
+
)
|
78
|
+
expect(WebMock).to have_requested(:post, host).with(body: "{\"foo\":\"bar\"}")
|
79
|
+
|
80
|
+
begin
|
81
|
+
tempfile = Tempfile.new
|
82
|
+
tempfile.write("hello world")
|
83
|
+
tempfile.rewind
|
84
|
+
|
85
|
+
http_post(
|
86
|
+
host,
|
87
|
+
body: File.open(tempfile.path)
|
88
|
+
)
|
89
|
+
expect(WebMock).to have_requested(:post, host).with(body: "hello world")
|
90
|
+
ensure
|
91
|
+
tempfile&.close!
|
92
|
+
end
|
93
|
+
|
73
94
|
# works !
|
74
95
|
# response = http_post(
|
75
96
|
# 'http://127.0.0.1:8085/end',
|
data/lib/ree_lib/version.rb
CHANGED