Skip to content

Commit

Permalink
Allow setting prefix path for rpc protocols (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanZhengYP authored Aug 27, 2021
1 parent c2f3afe commit 722f0b1
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ public void generateSharedComponents(GenerationContext context) {
+ "): Promise<$T> => {", "};", requestType, () -> {
// Get the hostname, port, and scheme from client's resolved endpoint. Then construct the request from
// them. The client's resolved endpoint can be default one or supplied by users.
writer.write("const {hostname, protocol = \"https\", port} = await context.endpoint();");
writer.write("const {hostname, protocol = \"https\", port, path: basePath} = await context.endpoint();");
writer.openBlock("const contents: any = {", "};", () -> {
writer.write("protocol,");
writer.write("hostname,");
writer.write("port,");
writer.write("method: \"POST\",");
writer.write("path,");
writer.write("path: basePath.endsWith(\"/\") ? basePath.slice(0, -1) + path : basePath + path,");
writer.write("headers,");
});
writer.openBlock("if (resolvedHostname !== undefined) {", "}", () -> {
Expand Down

0 comments on commit 722f0b1

Please sign in to comment.