spec/http2_spec.rb in knjrbfw-0.0.23 vs spec/http2_spec.rb in knjrbfw-0.0.24
- old
+ new
@@ -1,7 +1,30 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Http2" do
+ it "should be able to recursively parse post-data-hashes." do
+ require "knj/http2"
+
+ res = Knj::Http2.post_convert_data(
+ "test1" => "test2"
+ )
+ raise "Expected 'test1=test2' but got: '#{res}'." if res != "test1=test2"
+
+ res = Knj::Http2.post_convert_data(
+ "test1" => [1, 2, 3]
+ )
+ raise "Expected 'test1=1%3D12%3D23%3D3' but got: '#{res}'." if res != "test1=1%3D12%3D23%3D3"
+
+ res = Knj::Http2.post_convert_data(
+ "test1" => {
+ "order" => {
+ [:Bnet_profile, "profile_id"] => 5
+ }
+ }
+ )
+ raise "Expected 'test1=order%3D1%25253DBnet_profile2%25253Dprofile_id%253D5' but got: '#{res}'." if res != "test1=order%3D1%25253DBnet_profile2%25253Dprofile_id%253D5"
+ end
+
it "should be able to do multipart-requests." do
require "knj/http2"
require "knj/php"
http = Knj::Http2.new(:host => "www.partyworm.dk")
\ No newline at end of file