agoo 2.14.3 → 2.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: 843f3aa4a15a6ab57c7ff231930405c9ca55d3a6e33da3169a0677c420195fbe
4
- data.tar.gz: 03f6b8760c6f08c0a3f9b5f75c747b77d1d4666b00af20d7db231418dfeb3c69
3
+ metadata.gz: 1774bcd29b45056263ad986722015b99efa5c2bc8b0607b3a08afb79cd40cd70
4
+ data.tar.gz: dddc4062987102c87f1e2556ad425b33f3e0dd0a380c2a2416348ba2e07869d2
5
5
  SHA512:
6
- metadata.gz: '0684900cea98fbe812e5ae973ccd15dfaa054218340238dedfde382c535340945aea9857b98366fe52b2ff865129b299af541e940112200f2191b3b2247dfd58'
7
- data.tar.gz: 95e68a0a7bc5a3eb8cd34b9853e8d89285ef9a1c78765bf970e80cdeb51f7f41f53db4948ca2885e29eef3fa7a6b738e015d01c4cbb25e41b2f50bac1fcb50a9
6
+ metadata.gz: 5b4dbbe0b330c4456d46354019940e962a79229486b323940e20d3b8213416fd025d6279772b35f441bbbdd8e1fa5cfebe812ecba7f5d7e3a5ad16d46b41ef25
7
+ data.tar.gz: aad80f64bc75f27663c1372d02ced4a205ea5e89a5deba77619951cc09d0a083810f57520375a9fc8fe658e591f453367e1b4638f362ccfc95a2bbba3a183c7a
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All changes to the Agoo gem are documented here. Releases follow semantic versioning.
4
4
 
5
+ ## [2.15.0] - 2022-05-20
6
+
7
+ ### Added
8
+
9
+ - Support added for PATCH.
10
+
5
11
  ## [2.14.3] - 2022-05-05
6
12
 
7
13
  ### Fixed
data/ext/agoo/con.c CHANGED
@@ -327,6 +327,8 @@ con_header_read(agooCon c, size_t *mlenp) {
327
327
  method = AGOO_PUT;
328
328
  } else if (4 == b - c->buf && 0 == strncmp("POST", c->buf, 4)) {
329
329
  method = AGOO_POST;
330
+ } else if (5 == b - c->buf && 0 == strncmp("PATCH", c->buf, 5)) {
331
+ method = AGOO_PATCH;
330
332
  } else {
331
333
  return bad_request(c, 400, __LINE__);
332
334
  }
data/ext/agoo/rserver.c CHANGED
@@ -48,6 +48,7 @@ static VALUE options_sym;
48
48
  static VALUE post_sym;
49
49
  static VALUE push_env_key;
50
50
  static VALUE put_sym;
51
+ static VALUE patch_sym;
51
52
 
52
53
  static VALUE rserver;
53
54
 
@@ -971,6 +972,8 @@ handle(VALUE self, VALUE method, VALUE pattern, VALUE handler) {
971
972
  meth = AGOO_POST;
972
973
  } else if (put_sym == method) {
973
974
  meth = AGOO_PUT;
975
+ } else if (patch_sym == method) {
976
+ meth = AGOO_PATCH;
974
977
  } else if (Qnil == method) {
975
978
  meth = AGOO_ALL;
976
979
  } else {
@@ -1277,6 +1280,7 @@ server_init(VALUE mod) {
1277
1280
  options_sym = ID2SYM(rb_intern("OPTIONS")); rb_gc_register_address(&options_sym);
1278
1281
  post_sym = ID2SYM(rb_intern("POST")); rb_gc_register_address(&post_sym);
1279
1282
  put_sym = ID2SYM(rb_intern("PUT")); rb_gc_register_address(&put_sym);
1283
+ patch_sym = ID2SYM(rb_intern("PATCH")); rb_gc_register_address(&patch_sym);
1280
1284
 
1281
1285
  push_env_key = rb_str_new_cstr("rack.upgrade"); rb_gc_register_address(&push_env_key);
1282
1286
 
data/lib/agoo/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Agoo
3
3
  # Agoo version.
4
- VERSION = '2.14.3'
4
+ VERSION = '2.15.0'
5
5
  end
@@ -33,7 +33,7 @@ size=big
33
33
  ]
34
34
  elsif 'POST' == req['REQUEST_METHOD']
35
35
  [ 204, { }, [] ]
36
- elsif 'PUT' == req['REQUEST_METHOD']
36
+ elsif 'PUT' == req['REQUEST_METHOD'] || 'PATCH' == req['REQUEST_METHOD']
37
37
  [ 201,
38
38
  { },
39
39
  [ req['rack.input'].read ]
@@ -65,6 +65,7 @@ size=big
65
65
  Agoo::Server.handle(:GET, "/tellme", handler)
66
66
  Agoo::Server.handle(:POST, "/makeme", handler)
67
67
  Agoo::Server.handle(:PUT, "/makeme", handler)
68
+ Agoo::Server.handle(:PATCH, "/makeme", handler)
68
69
 
69
70
  Agoo::Server.start()
70
71
 
@@ -156,4 +157,20 @@ size=big
156
157
  assert_equal('hello', res.body)
157
158
  end
158
159
 
160
+ def test_patch
161
+ uri = URI('http://localhost:6467/makeme')
162
+ req = Net::HTTP::Patch.new(uri)
163
+ # Set the headers the way we want them.
164
+ req['Accept-Encoding'] = '*'
165
+ req['Accept'] = 'application/json'
166
+ req['User-Agent'] = 'Ruby'
167
+ req.body = 'hello'
168
+
169
+ res = Net::HTTP.start(uri.hostname, uri.port) { |h|
170
+ h.request(req)
171
+ }
172
+ assert_equal(Net::HTTPCreated, res.class)
173
+ assert_equal('hello', res.body)
174
+ end
175
+
159
176
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agoo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.14.3
4
+ version: 2.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-05 00:00:00.000000000 Z
11
+ date: 2022-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj