jets 3.0.13 → 3.0.14

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: a8e4fbbeb4ae84a9c2f7d3c6fac9fdbb6cdcda684ae9387ba8c09b4f7c07cb7e
4
- data.tar.gz: 0ca4432001005d29d4104cf48c2e92d68abb6d3018e2fdc15f3cc5f50769a703
3
+ metadata.gz: 571efa758f33bf44042d6e8be73c933011680217cd4e87b0324f85b5fc7c37dc
4
+ data.tar.gz: fac7b4ceae0b9d7e0fe8f494f57cf409d71a08d26dbd259424800d3a9feb268b
5
5
  SHA512:
6
- metadata.gz: 79ac35eaf167a60a3bd6ab384fd5cd2cee55adaf3726d72d2c2648103af4153c7906560ac6977b270f55d69e4ce641582bd8f8e8e9a102af9ecbaffa071b50bd
7
- data.tar.gz: 0df8301c1d590dc62119baf244eedd93d152b5d23d2149304d4223d28f7fd4b733eb05f9fcd69c8faba5df873e0023c4d88de694717d0493d30b627091110d2a
6
+ metadata.gz: 3ee364750aaa8c1f74a92ec9da2363e77cd7af84db97977b54a40cb087a32bbbec4e413b5cac5117018468c84b23ed18646f5416b9aaf3d425e668dabfb21b6c
7
+ data.tar.gz: 446e82b01a2d07679d1f51f8dd7e461d7ddfd67a46759fc22fa59c740fe8f6011a711a7acdc80ea1d4e62786f8e79eec7596c283f3758fd9734546d2bb555953
data/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## [3.0.14] - 2021-09-01
7
+ - [#583](https://github.com/boltops-tools/jets/pull/583) Don't overwrite content_type when rendering json or xml with content_type specified
8
+ - [#584](https://github.com/boltops-tools/jets/pull/584) Adds an override flag to change behaviour when Jets is behind an ELB running Jets Server
9
+ - [#585](https://github.com/boltops-tools/jets/pull/585) add_stage controller method
10
+ - [#586](https://github.com/boltops-tools/jets/pull/586) JETS_ELB env var flag
11
+
6
12
  ## [3.0.13] - 2021-08-17
7
13
  - [#582](https://github.com/boltops-tools/jets/pull/582) use Shotgun::Static middleware always
8
14
 
@@ -70,6 +70,7 @@ module Jets::Controller::Middleware
70
70
 
71
71
  def on_aws?(env)
72
72
  return false if Jets.env.test? # usually with test we're passing in full API Gateway fixtures with the HTTP_X_AMZN_TRACE_ID
73
+ return false if ENV['JETS_ELB'] # If we're using an ELB and Jets is inside a container running jets server, we don't want to pretend we're on AWS.
73
74
  on_cloud9 = !!(env['HTTP_HOST'] =~ /cloud9\..*\.amazonaws\.com/)
74
75
  !!env['HTTP_X_AMZN_TRACE_ID'] && !on_cloud9
75
76
  end
@@ -7,16 +7,7 @@ class Jets::Controller
7
7
  raise "redirect_to url parameter must be a String. Please pass in a string"
8
8
  end
9
9
 
10
- uri = URI.parse(url)
11
- # if no location.host, we been provided a relative host
12
- if !uri.host && actual_host
13
- url = "/#{url}" unless url.starts_with?('/')
14
- url = add_stage_name(url)
15
- redirect_url = actual_host + url
16
- else
17
- redirect_url = url
18
- end
19
-
10
+ redirect_url = add_stage(url)
20
11
  redirect_url = ensure_protocol(redirect_url)
21
12
 
22
13
  aws_proxy = Rendering::RackRenderer.new(self,
@@ -33,6 +33,8 @@ class Jets::Controller
33
33
  end
34
34
 
35
35
  def adjust_content_type!(options)
36
+ return if options.key?(:content_type)
37
+
36
38
  if options.key?(:json)
37
39
  options[:content_type] = "application/json"
38
40
  elsif options.key?(:xml)
@@ -60,15 +62,26 @@ class Jets::Controller
60
62
  rest.merge(template: template)
61
63
  end
62
64
 
63
- # Add API Gateway Stage Name
64
- def add_stage_name(url)
65
+ # Example usage:
66
+ #
67
+ # render json: {success: true, location: add_stage(posts_path)}
68
+ #
69
+ def add_stage(url)
65
70
  return url unless actual_host
66
71
 
67
- Jets::Controller::Stage.add(actual_host, url)
72
+ uri = URI.parse(url)
73
+ # if no location.host, we been provided a relative host
74
+ if !uri.host && actual_host
75
+ url = "/#{url}" unless url.starts_with?('/')
76
+ url = Jets::Controller::Stage.add(actual_host, url)
77
+ actual_host + url
78
+ else
79
+ url
80
+ end
68
81
  end
69
82
 
70
83
  def url_for(url)
71
- add_stage_name(url)
84
+ add_stage(url)
72
85
  end
73
86
 
74
87
  # Actual host can be headers["origin"] when cloudfront is in front.
data/lib/jets/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "3.0.13"
2
+ VERSION = "3.0.14"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jets
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.13
4
+ version: 3.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-17 00:00:00.000000000 Z
11
+ date: 2021-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer