Sha256: e4f218c463c6f7f3cde901b98c3e1168962e173f8ac5910566b0906b17cdf246

Contents?: true

Size: 406 Bytes

Versions: 4

Compression:

Stored size: 406 Bytes

Contents

require_relative "../lib/tynn/json_parser"

headers = {
  "CONTENT_TYPE" => "application/json"
}

test "json body parse" do
  Tynn.helpers(Tynn::JSONParser)

  params = { "foo" => "foo" }

  Tynn.define do
    root do
      res.write(JSON.generate(req.params))
    end
  end

  app = Tynn::Test.new(Tynn)
  app.post("/", JSON.generate(params), headers)

  assert_equal params, JSON.parse(app.res.body)
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tynn-1.0.0.rc1 test/json_parser_test.rb
tynn-0.0.4 test/json_parser_test.rb
tynn-0.0.3 test/json_parser_test.rb
tynn-0.0.2 test/json_parser.rb