functions_framework 0.1.0 → 0.1.1

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: d09328e219e183d857a5b0e5cbb4a9aac77dcb2b6deea96ecb4909729aac5e46
4
- data.tar.gz: 2ffdd21b22c08193b64610ac42ee05f6b5627c25b99ee6d2d45eb52408438e33
3
+ metadata.gz: 1458a2e7cef4ad3841ae328a79cd95ee8a5eea0091fb9dd6e618d443725a304a
4
+ data.tar.gz: 6294b3dcf3ec251ba3c026588b5eb28559353a9e09316ff9965b25a81511d725
5
5
  SHA512:
6
- metadata.gz: 93cf161a26eee8349e99ec7012698374206e333099c94ecff07609bdefe9f7a33bf331aa3a0b305fd005e0a89ba9988bcc3ed3ce4c2c1edadd587975561b5fe8
7
- data.tar.gz: 64eea2572a244dca261c090b6e51445b2f59ad2ad985edb29dc2a52aaa902fd9d9afa44e65e6ca51a6653c16d5532ace49cb9a6defd09c45195d9d81e9238707
6
+ metadata.gz: ec252cf13280072a0882292326b5b9d881efef8db349268f2d380996fc94180fbb203707d47f92d3c0dee31758f8f733b26a24219191df523cd8420f3562ba3e
7
+ data.tar.gz: 44eb7e2c387710b77e0cf2676f00aaf259e67f84a1bad1b1b531c130b1cf37140681833bf5004d224ba82f0912f5dc6e0ebb2686e50be2cf0350c9ff7df9d821
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ### v0.1.1 / 2020-02-27
4
+
5
+ * Server returns 404 when receiving a /favicon.ico or /robots.txt request.
6
+ * Correct a rack constant name in Testing#make_post_request
7
+
3
8
  ### v0.1.0 / 2020-01-30
4
9
 
5
10
  * Initial release
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::INPUT_STREAM] = ::StringIO.new data
148
+ env[::Rack::RACK_INPUT] = ::StringIO.new data
149
149
  ::Rack::Request.new env
150
150
  end
151
151
 
@@ -17,5 +17,5 @@ module FunctionsFramework
17
17
  # Version of the Ruby Functions Framework
18
18
  # @return [String]
19
19
  #
20
- VERSION = "0.1.0".freeze
20
+ VERSION = "0.1.1".freeze
21
21
  end
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.0
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-01-30 00:00:00.000000000 Z
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.9.3
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.9.3
124
+ version: 0.10.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: yard
127
127
  requirement: !ruby/object:Gem::Requirement