functions_framework 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/lib/functions_framework/server.rb +13 -0
- data/lib/functions_framework/testing.rb +1 -1
- data/lib/functions_framework/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1458a2e7cef4ad3841ae328a79cd95ee8a5eea0091fb9dd6e618d443725a304a
|
4
|
+
data.tar.gz: 6294b3dcf3ec251ba3c026588b5eb28559353a9e09316ff9965b25a81511d725
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec252cf13280072a0882292326b5b9d881efef8db349268f2d380996fc94180fbb203707d47f92d3c0dee31758f8f733b26a24219191df523cd8420f3562ba3e
|
7
|
+
data.tar.gz: 44eb7e2c387710b77e0cf2676f00aaf259e67f84a1bad1b1b531c130b1cf37140681833bf5004d224ba82f0912f5dc6e0ebb2686e50be2cf0350c9ff7df9d821
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Functions Framework
|
1
|
+
# Functions Framework [![Documentation](https://img.shields.io/badge/docs-FunctionsFramework-red.svg)](https://rubydoc.info/gems/functions_framework/FunctionsFramework) [![Gem Version](https://badge.fury.io/rb/functions_framework.svg)](https://badge.fury.io/rb/functions_framework)
|
2
2
|
|
3
3
|
An open source framework for writing lightweight, portable Ruby functions that
|
4
4
|
run in a serverless environment. Functions written to this Framework will run
|
@@ -315,10 +315,17 @@ module FunctionsFramework
|
|
315
315
|
|
316
316
|
## @private
|
317
317
|
class AppBase
|
318
|
+
BLACKLISTED_PATHS = ["/favicon.ico", "/robots.txt"].freeze
|
319
|
+
|
318
320
|
def initialize config
|
319
321
|
@config = config
|
320
322
|
end
|
321
323
|
|
324
|
+
def blacklisted_path? env
|
325
|
+
path = env[::Rack::SCRIPT_NAME].to_s + env[::Rack::PATH_INFO].to_s
|
326
|
+
BLACKLISTED_PATHS.include? path
|
327
|
+
end
|
328
|
+
|
322
329
|
def interpret_response response
|
323
330
|
case response
|
324
331
|
when ::Array
|
@@ -340,6 +347,10 @@ module FunctionsFramework
|
|
340
347
|
end
|
341
348
|
end
|
342
349
|
|
350
|
+
def notfound_response
|
351
|
+
string_response "Not found", "text/plain", 404
|
352
|
+
end
|
353
|
+
|
343
354
|
def string_response string, content_type, status
|
344
355
|
headers = {
|
345
356
|
"Content-Type" => content_type,
|
@@ -373,6 +384,7 @@ module FunctionsFramework
|
|
373
384
|
end
|
374
385
|
|
375
386
|
def call env
|
387
|
+
return notfound_response if blacklisted_path? env
|
376
388
|
response =
|
377
389
|
begin
|
378
390
|
logger = env["rack.logger"] = @config.logger
|
@@ -395,6 +407,7 @@ module FunctionsFramework
|
|
395
407
|
end
|
396
408
|
|
397
409
|
def call env
|
410
|
+
return notfound_response if blacklisted_path? env
|
398
411
|
logger = env["rack.logger"] = @config.logger
|
399
412
|
event =
|
400
413
|
begin
|
@@ -145,7 +145,7 @@ module FunctionsFramework
|
|
145
145
|
def make_post_request url, data, headers = []
|
146
146
|
env = Testing.build_standard_env URI(url), headers
|
147
147
|
env[::Rack::REQUEST_METHOD] = ::Rack::POST
|
148
|
-
env[::Rack::
|
148
|
+
env[::Rack::RACK_INPUT] = ::StringIO.new data
|
149
149
|
::Rack::Request.new env
|
150
150
|
end
|
151
151
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: functions_framework
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Azuma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puma
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.
|
117
|
+
version: 0.10.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.
|
124
|
+
version: 0.10.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: yard
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|