Skip to content

Commit f82800c

Browse files
committed
fix: AgentCore Gateway now correctly returns 405 for GET requests
1 parent 5759d82 commit f82800c

File tree

2 files changed

+0
-28
lines changed

2 files changed

+0
-28
lines changed

e2e_tests/typescript/src/server_clients/automated_oauth.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -520,20 +520,6 @@ export class AutomatedOAuthClient extends Server {
520520
const baseUrl = new URL(this.config.serverUrl);
521521
const transport = new StreamableHTTPClientTransport(baseUrl, {
522522
authProvider: this.oauthProvider,
523-
// Override fetch to handle POST-only endpoints.
524-
// This is a temporary workaround for AgentCore Gateways,
525-
// which currently return 404 on GET requests, instead of the expected 405
526-
fetch: async (url, init) => {
527-
logger.debug(`Fetch request: ${init?.method || 'GET'} ${url}`);
528-
if (init?.method === "GET") {
529-
logger.debug("Blocking GET request, returning 405");
530-
return new Response(null, {
531-
status: 405,
532-
statusText: "Method Not Allowed",
533-
});
534-
}
535-
return fetch(url, init);
536-
},
537523
});
538524

539525
logger.debug("Connecting with automated OAuth...");

examples/chatbots/typescript/src/server_clients/interactive_oauth.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -532,20 +532,6 @@ export class InteractiveOAuthClient extends Server {
532532
const baseUrl = new URL(this.config.serverUrl);
533533
const transport = new StreamableHTTPClientTransport(baseUrl, {
534534
authProvider: oauthProvider,
535-
// Override fetch to handle POST-only endpoints
536-
// This is a temporary workaround for AgentCore Gateways,
537-
// which currently return 404 on GET requests, instead of the expected 405
538-
fetch: async (url, init) => {
539-
logger.debug(`Fetch request: ${init?.method || 'GET'} ${url}`);
540-
if (init?.method === "GET") {
541-
logger.debug("Blocking GET request, returning 405");
542-
return new Response(null, {
543-
status: 405,
544-
statusText: "Method Not Allowed",
545-
});
546-
}
547-
return fetch(url, init);
548-
},
549535
});
550536

551537
try {

0 commit comments

Comments
 (0)