• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

NYULibraries / salon / #215

22 Dec 2023 06:47PM UTC coverage: 94.628% (-2.9%) from 97.566%
#215

push

458 of 484 relevant lines covered (94.63%)

128.98 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/app/helpers/json_helpers.rb
1
require 'sinatra/base'
1✔
2
require 'json'
1✔
3

4
module Sinatra
1✔
5
  module JsonHelper
1✔
6
    def json_params
1✔
7
      begin
8
        body = request.body.read
39✔
9
        @json_params ||= JSON.parse(body)
39✔
10
      rescue JSON::ParserError => e
4✔
11
        puts "Invalid json: #{e.message} --- body: #{body}"
4✔
12
        halt 400, { error: "Invalid JSON #{e.message}" }.to_json
4✔
13
      end
14
    end
15

16
    def export_json_to_redis
1✔
17
      json_params.each do |key, url|
×
18
        redis.set key, url
×
19
      end
20
    end
21
  end
22

23
  helpers JsonHelper
1✔
24
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc