-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add --globoff option to shell_curl (#199)
* Add nested query fixture * Add --globoff option to shell/curl * Update expected output to match recent changes
- Loading branch information
1 parent
200b1fd
commit 71eec07
Showing
38 changed files
with
424 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CURL *hnd = curl_easy_init(); | ||
|
||
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET"); | ||
curl_easy_setopt(hnd, CURLOPT_URL, "http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value"); | ||
|
||
CURLcode ret = curl_easy_perform(hnd); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(require '[clj-http.client :as client]) | ||
|
||
(client/get "http://mockbin.com/har" {:query-params {:foo[bar] "baz,zap" | ||
:fiz "buz" | ||
:key "value"}}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
var client = new HttpClient(); | ||
var request = new HttpRequestMessage | ||
{ | ||
Method = HttpMethod.Get, | ||
RequestUri = new Uri("http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value"), | ||
}; | ||
using (var response = await client.SendAsync(request)) | ||
{ | ||
response.EnsureSuccessStatusCode(); | ||
var body = await response.Content.ReadAsStringAsync(); | ||
Console.WriteLine(body); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var client = new RestClient("http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value"); | ||
var request = new RestRequest(Method.GET); | ||
IRestResponse response = client.Execute(request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"net/http" | ||
"io/ioutil" | ||
) | ||
|
||
func main() { | ||
|
||
url := "http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value" | ||
|
||
req, _ := http.NewRequest("GET", url, nil) | ||
|
||
res, _ := http.DefaultClient.Do(req) | ||
|
||
defer res.Body.Close() | ||
body, _ := ioutil.ReadAll(res.Body) | ||
|
||
fmt.Println(res) | ||
fmt.Println(string(body)) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
GET /har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value HTTP/1.1 | ||
Host: mockbin.com | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
AsyncHttpClient client = new DefaultAsyncHttpClient(); | ||
client.prepare("GET", "http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value") | ||
.execute() | ||
.toCompletableFuture() | ||
.thenAccept(System.out::println) | ||
.join(); | ||
|
||
client.close(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
HttpRequest request = HttpRequest.newBuilder() | ||
.uri(URI.create("http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value")) | ||
.method("GET", HttpRequest.BodyPublishers.noBody()) | ||
.build(); | ||
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); | ||
System.out.println(response.body()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
OkHttpClient client = new OkHttpClient(); | ||
|
||
Request request = new Request.Builder() | ||
.url("http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value") | ||
.get() | ||
.build(); | ||
|
||
Response response = client.newCall(request).execute(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
HttpResponse<String> response = Unirest.get("http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value") | ||
.asString(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import axios from "axios"; | ||
|
||
const options = { | ||
method: 'GET', | ||
url: 'http://mockbin.com/har', | ||
params: {'foo[bar]': 'baz,zap', fiz: 'buz', key: 'value'} | ||
}; | ||
|
||
axios.request(options).then(function (response) { | ||
console.log(response.data); | ||
}).catch(function (error) { | ||
console.error(error); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const options = {method: 'GET'}; | ||
|
||
fetch('http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value', options) | ||
.then(response => response.json()) | ||
.then(response => console.log(response)) | ||
.catch(err => console.error(err)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const settings = { | ||
"async": true, | ||
"crossDomain": true, | ||
"url": "http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value", | ||
"method": "GET", | ||
"headers": {} | ||
}; | ||
|
||
$.ajax(settings).done(function (response) { | ||
console.log(response); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const data = null; | ||
|
||
const xhr = new XMLHttpRequest(); | ||
xhr.withCredentials = true; | ||
|
||
xhr.addEventListener("readystatechange", function () { | ||
if (this.readyState === this.DONE) { | ||
console.log(this.responseText); | ||
} | ||
}); | ||
|
||
xhr.open("GET", "http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value"); | ||
|
||
xhr.send(data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
val client = OkHttpClient() | ||
|
||
val request = Request.Builder() | ||
.url("http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value") | ||
.get() | ||
.build() | ||
|
||
val response = client.newCall(request).execute() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var axios = require("axios").default; | ||
|
||
var options = { | ||
method: 'GET', | ||
url: 'http://mockbin.com/har', | ||
params: {'foo[bar]': 'baz,zap', fiz: 'buz', key: 'value'} | ||
}; | ||
|
||
axios.request(options).then(function (response) { | ||
console.log(response.data); | ||
}).catch(function (error) { | ||
console.error(error); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const fetch = require('node-fetch'); | ||
|
||
let url = 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value'; | ||
|
||
let options = {method: 'GET'}; | ||
|
||
fetch(url, options) | ||
.then(res => res.json()) | ||
.then(json => console.log(json)) | ||
.catch(err => console.error('error:' + err)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const http = require("http"); | ||
|
||
const options = { | ||
"method": "GET", | ||
"hostname": "mockbin.com", | ||
"port": null, | ||
"path": "/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value", | ||
"headers": {} | ||
}; | ||
|
||
const req = http.request(options, function (res) { | ||
const chunks = []; | ||
|
||
res.on("data", function (chunk) { | ||
chunks.push(chunk); | ||
}); | ||
|
||
res.on("end", function () { | ||
const body = Buffer.concat(chunks); | ||
console.log(body.toString()); | ||
}); | ||
}); | ||
|
||
req.end(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const request = require('request'); | ||
|
||
const options = { | ||
method: 'GET', | ||
url: 'http://mockbin.com/har', | ||
qs: {'foo[bar]': 'baz,zap', fiz: 'buz', key: 'value'} | ||
}; | ||
|
||
request(options, function (error, response, body) { | ||
if (error) throw new Error(error); | ||
|
||
console.log(body); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const unirest = require("unirest"); | ||
|
||
const req = unirest("GET", "http://mockbin.com/har"); | ||
|
||
req.query({ | ||
"foo[bar]": "baz,zap", | ||
"fiz": "buz", | ||
"key": "value" | ||
}); | ||
|
||
req.end(function (res) { | ||
if (res.error) throw new Error(res.error); | ||
|
||
console.log(res.body); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#import <Foundation/Foundation.h> | ||
|
||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value"] | ||
cachePolicy:NSURLRequestUseProtocolCachePolicy | ||
timeoutInterval:10.0]; | ||
[request setHTTPMethod:@"GET"]; | ||
|
||
NSURLSession *session = [NSURLSession sharedSession]; | ||
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request | ||
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { | ||
if (error) { | ||
NSLog(@"%@", error); | ||
} else { | ||
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response; | ||
NSLog(@"%@", httpResponse); | ||
} | ||
}]; | ||
[dataTask resume]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
open Cohttp_lwt_unix | ||
open Cohttp | ||
open Lwt | ||
|
||
let uri = Uri.of_string "http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value" in | ||
|
||
Client.call `GET uri | ||
>>= fun (res, body_stream) -> | ||
(* Do stuff with the result *) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
$curl = curl_init(); | ||
|
||
curl_setopt_array($curl, [ | ||
CURLOPT_URL => "http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value", | ||
CURLOPT_RETURNTRANSFER => true, | ||
CURLOPT_ENCODING => "", | ||
CURLOPT_MAXREDIRS => 10, | ||
CURLOPT_TIMEOUT => 30, | ||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, | ||
CURLOPT_CUSTOMREQUEST => "GET", | ||
]); | ||
|
||
$response = curl_exec($curl); | ||
$err = curl_error($curl); | ||
|
||
curl_close($curl); | ||
|
||
if ($err) { | ||
echo "cURL Error #:" . $err; | ||
} else { | ||
echo $response; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
$request = new HttpRequest(); | ||
$request->setUrl('http://mockbin.com/har'); | ||
$request->setMethod(HTTP_METH_GET); | ||
|
||
$request->setQueryData([ | ||
'foo[bar]' => 'baz,zap', | ||
'fiz' => 'buz', | ||
'key' => 'value' | ||
]); | ||
|
||
try { | ||
$response = $request->send(); | ||
|
||
echo $response->getBody(); | ||
} catch (HttpException $ex) { | ||
echo $ex; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
$client = new http\Client; | ||
$request = new http\Client\Request; | ||
|
||
$request->setRequestUrl('http://mockbin.com/har'); | ||
$request->setRequestMethod('GET'); | ||
$request->setQuery(new http\QueryString([ | ||
'foo[bar]' => 'baz,zap', | ||
'fiz' => 'buz', | ||
'key' => 'value' | ||
])); | ||
|
||
$client->enqueue($request)->send(); | ||
$response = $client->getResponse(); | ||
|
||
echo $response->getBody(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$response = Invoke-RestMethod -Uri 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value' -Method GET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$response = Invoke-WebRequest -Uri 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value' -Method GET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import http.client | ||
|
||
conn = http.client.HTTPConnection("mockbin.com") | ||
|
||
conn.request("GET", "/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value") | ||
|
||
res = conn.getresponse() | ||
data = res.read() | ||
|
||
print(data.decode("utf-8")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import requests | ||
|
||
url = "http://mockbin.com/har" | ||
|
||
querystring = {"foo[bar]":"baz,zap","fiz":"buz","key":"value"} | ||
|
||
response = requests.request("GET", url, params=querystring) | ||
|
||
print(response.text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
library(httr) | ||
|
||
url <- "http://mockbin.com/har" | ||
|
||
queryString <- list( | ||
foo[bar] = "baz,zap", | ||
fiz = "buz" | ||
) | ||
|
||
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream")) | ||
|
||
content(response, "text") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'uri' | ||
require 'net/http' | ||
|
||
url = URI("http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value") | ||
|
||
http = Net::HTTP.new(url.host, url.port) | ||
|
||
request = Net::HTTP::Get.new(url) | ||
|
||
response = http.request(request) | ||
puts response.read_body |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
curl --request GET \ | ||
--url 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
http GET 'http://mockbin.com/har?foo%5Bbar%5D=baz%2Czap&fiz=buz&key=value' |
Oops, something went wrong.