Grafana k6 with googleapis

I was able to get the mail body using the following code where I only pass two parameters inside the http.get() method. As per the documentation we can only pass two parameters inside http.get() method.

const options = {
      url: 'https://gmail.googleapis.com/gmail/v1/users/skillfit.tests@gmail.com/messages',
      params: {
        // q: `from:no-reply@rework.link to:${profilesEmailAddress}`,
      // },
        headers: {
          Authorization: `Bearer ${accessToken.access_token}`,
        },
      }
    };
    const response = await http.get('https://gmail.googleapis.com/gmail/v1/users/skillfit.tests@gmail.com/messages?q=from:no-reply@rework.link%20to:skillfit.tests@gmail.com', options.params);

I inserted the query parameter to the link to search for the specified mail from the user “no-reply@rework.link”

1 Like