rack-iframe-transport 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +1 -1
  2. data/lib/rack_iframe_transport.rb +14 -3
  3. metadata +7 -4
data/README.md CHANGED
@@ -20,7 +20,7 @@ Since you can't get headers from an iframe post, metadata are exposed as `'data-
20
20
  {"message":"Unauthorized"}
21
21
 
22
22
  > curl 'localhost:3000/api/2/account?X-Requested-With=IFrame'
23
- <!DOCTYPE html><html><body><textarea 'data-status'='401' 'data-statusText'='Unauthorized' 'data-type'='text/html'>{"message":"Unauthorized"}</textarea></body></html>
23
+ <!DOCTYPE html><html><body><textarea data-status='401' data-statusText='Unauthorized' data-type='text/html'>{"message":"Unauthorized"}</textarea></body></html>
24
24
  ```
25
25
 
26
26
  How?
@@ -11,8 +11,13 @@ module Rack
11
11
  def _call(env)
12
12
  @status, @headers, @response = @app.call(env)
13
13
  @request = Rack::Request.new(env)
14
- @headers['Content-Type'] = 'text/html' if iframe_transport?
15
- [@status, @headers, self]
14
+
15
+ if iframe_transport?
16
+ @headers['Content-Type'] = 'text/html'
17
+ [@status, @headers, self]
18
+ else
19
+ [@status, @headers, @response]
20
+ end
16
21
  end
17
22
 
18
23
  def each(&block)
@@ -40,5 +45,11 @@ module Rack
40
45
  meta['data-type'] = @headers['Content-Type'] if @headers.has_key?('Content-Type')
41
46
  meta.map {|key,value| "#{key}='#{value}'" }.join(' ')
42
47
  end
48
+
49
+ private
50
+
51
+ def method_missing(method, *args)
52
+ @response.send(method.intern, *args)
53
+ end
43
54
  end
44
- end
55
+ end
metadata CHANGED
@@ -1,18 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-iframe-transport
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Charles Barbier
9
+ - Saimon Moore
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2012-07-31 00:00:00.000000000 Z
13
+ date: 2012-10-19 00:00:00.000000000 Z
13
14
  dependencies: []
14
15
  description:
15
- email: unixcharles@gmail.com
16
+ email:
17
+ - unixcharles@gmail.com
18
+ - saimonmoore@gmail.com
16
19
  executables: []
17
20
  extensions: []
18
21
  extra_rdoc_files: []
@@ -40,7 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
40
43
  version: '0'
41
44
  requirements: []
42
45
  rubyforge_project:
43
- rubygems_version: 1.8.24
46
+ rubygems_version: 1.8.23
44
47
  signing_key:
45
48
  specification_version: 3
46
49
  summary: Rack middleware for iframe-transport hacks.