Unsupported protocol scheme
bookmoons opened this issue · 6 comments
bookmoons commented
A runtime error is observed with a certain collection:
Get : unsupported protocol scheme ""
Reported by @danni-popova in #43.
bookmoons commented
Example conversion result that hits the error.
// Auto-generated by the Load Impact converter
import "./libs/spo-gpo.js";
import "./libs/shim/core.js";
import URI from "./libs/urijs.js";
import aws4 from "./libs/aws4.js";
export let options = { maxRedirects: 4 };
const Request = Symbol.for("request");
postman[Symbol.for("initial")]({
options
});
export default function() {
postman[Request]({
name: "discovery",
id: "aa538977-373a-463b-937a-f371ddd71968",
method: "GET",
address:
"https://{replaced_url}",
auth(config, Var) {
const address = new URI(config.address);
const options = {
method: "GET",
protocol: address.protocol(),
hostname: address.hostname(),
port: address.port(),
path: address.path() + address.search(),
region: "eu-west-1",
service: "cf"
};
const credential = {
accessKeyId: "{replaced_access_key}",
secretAccessKey: "{replaced_secret_key}"
};
const signed = aws4.sign(options, credential);
const [path, query] = signed.path.split("?");
config.address = new URI()
.protocol(address.protocol())
.hostname(signed.hostname)
.path(path)
.query(query)
.toString();
Object.assign(config.headers, signed.headers);
}
});
}
bookmoons commented
This might be something to do with the AWS auth logic.
bookmoons commented
I remember now I saw this and thought AWS requests require a query, so it wouldn't come up. It happens when the URL has no query string. You end up with undefined
and it nulls out some later values.
I'll get a patch underway, but you can work around it by changing this line:
const [path, query] = signed.path.split("?");
To this, to default query to the right type even when it's empty:
const [path, query = ""] = signed.path.split("?");
danni-popova commented
That worked! Thank you ever so much for looking into this!
bookmoons commented
Quite welcome!