How to use the integration fetch wrapper - Amazon WAF, Amazon Firewall Manager, Amazon Shield Advanced, and Amazon Shield network security director
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Introducing a new console experience for Amazon WAF

You can now use the updated experience to access Amazon WAF functionality anywhere in the console. For more details, see Working with the updated console experience.

How to use the integration fetch wrapper

This section provides instructions for using the integration fetch wrapper.

You can use the Amazon WAF fetch wrapper by changing your normal fetch calls to the fetch API under the AwsWafIntegration namespace. The Amazon WAF wrapper supports all of the same options as the standard JavaScript fetch API call and adds the token handling for the integration. This approach is generally the simplest way to integrate your application.

Before the wrapper implementation

The following example listing shows standard code before implementing the AwsWafIntegration fetch wrapper.

const login_response = await fetch(login_url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: login_body });
After the wrapper implementation

The following listing shows the same code with the AwsWafIntegration fetch wrapper implementation.

const login_response = await AwsWafIntegration.fetch(login_url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: login_body });