This repository has been archived on 2024-09-11. You can view files and clone it, but cannot push or open issues or pull requests.
svrjs-blog-newsletter/cronjob/node_modules/@smithy/smithy-client/dist-es/resolve-path.js

20 lines
855 B
JavaScript
Raw Normal View History

2024-05-26 22:54:55 +02:00
import { extendedEncodeURIComponent } from "./extended-encode-uri-component";
export const resolvedPath = (resolvedPath, input, memberName, labelValueProvider, uriLabel, isGreedyLabel) => {
if (input != null && input[memberName] !== undefined) {
const labelValue = labelValueProvider();
if (labelValue.length <= 0) {
throw new Error("Empty value provided for input HTTP label: " + memberName + ".");
}
resolvedPath = resolvedPath.replace(uriLabel, isGreedyLabel
? labelValue
.split("/")
.map((segment) => extendedEncodeURIComponent(segment))
.join("/")
: extendedEncodeURIComponent(labelValue));
}
else {
throw new Error("No value provided for input HTTP label: " + memberName + ".");
}
return resolvedPath;
};