Skip to content

Commit

Permalink
Update path parameter to follow RFC/generic HTTP convention (#737) (#744
Browse files Browse the repository at this point in the history
)

* Update path parameter to follow RFC/generic HTTP convention

Signed-off-by: suzhou <suzhou@amazon.com>

* Update path parameter to follow RFC/generic HTTP convention

Signed-off-by: suzhou <suzhou@amazon.com>

---------

Signed-off-by: suzhou <suzhou@amazon.com>
(cherry picked from commit a4a6a8d)
  • Loading branch information
SuZhou-Joe authored May 18, 2023
1 parent 120911c commit 0b7fc0b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions server/services/CommonService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@ export default class IndexService {
const { endpoint, data, hideLog } = usedParam || {};
try {
const { callAsCurrentUser: callWithRequest } = this.osDriver.asScoped(request);

const payload = useQuery ? JSON.parse(data || "{}") : data;
const finalData = data;
/**
* Update path parameter to follow RFC/generic HTTP convention
*/
if (endpoint === "transport.request" && typeof finalData?.path === "string" && !/^\//.test(finalData?.path || "")) {
finalData.path = `/${finalData.path || ""}`;
}
const payload = useQuery ? JSON.parse(finalData || "{}") : finalData;
const commonCallerResponse = await callWithRequest(endpoint, payload || {});
return response.custom({
statusCode: 200,
Expand Down

0 comments on commit 0b7fc0b

Please sign in to comment.