| 49 | | } |
|---|
| 50 | | request = issue(config); |
|---|
| | 49 | }; |
|---|
| | 50 | request = issue(config); |
|---|
| | 51 | |
|---|
| | 52 | // test that params are serialized as query string - 1 test |
|---|
| | 53 | config = { |
|---|
| | 54 | method: "GET", |
|---|
| | 55 | url: "http://example.com/", |
|---|
| | 56 | params: {"foo": "bar"} |
|---|
| | 57 | }; |
|---|
| | 58 | proto.open = function(method, url, async, user, password) { |
|---|
| | 59 | t.eq(url, config.url + "?foo=bar", "params serialized as query string"); |
|---|
| | 60 | }; |
|---|
| | 61 | request = issue(config); |
|---|
| | 62 | |
|---|
| | 63 | // test that empty params object doesn't produce query string - 1 test |
|---|
| | 64 | config = { |
|---|
| | 65 | method: "GET", |
|---|
| | 66 | url: "http://example.com/", |
|---|
| | 67 | params: {} |
|---|
| | 68 | }; |
|---|
| | 69 | proto.open = function(method, url, async, user, password) { |
|---|
| | 70 | t.eq(url, config.url, "empty params doesn't produce query string"); |
|---|
| | 71 | } |
|---|
| | 72 | request = issue(config); |
|---|
| | 73 | |
|---|
| | 74 | // test that query string doesn't get two ? separators |
|---|
| | 75 | config = { |
|---|
| | 76 | method: "GET", |
|---|
| | 77 | url: "http://example.com/?existing=query", |
|---|
| | 78 | params: {"foo": "bar"} |
|---|
| | 79 | }; |
|---|
| | 80 | proto.open = function(method, url, async, user, password) { |
|---|
| | 81 | t.eq(url, config.url + "&foo=bar", "existing query string gets extended with &"); |
|---|
| | 82 | } |
|---|
| | 83 | request = issue(config); |
|---|
| | 84 | |
|---|
| | 85 | // reset open method |
|---|