Skip to content

Stop axios from throwing error on non-2xx response#5832

Merged
christopherholland-workday merged 1 commit into
mainfrom
axios-fix
Feb 24, 2026
Merged

Stop axios from throwing error on non-2xx response#5832
christopherholland-workday merged 1 commit into
mainfrom
axios-fix

Conversation

@christopherholland-workday
Copy link
Copy Markdown
Contributor

@christopherholland-workday christopherholland-workday commented Feb 24, 2026

Stop axios from throwing error on non-2xx response.

Adding validateStatus: () => true tells Axios to treat all HTTP status codes (including 302) as successful responses rather than throwing. This lets the existing redirect-handling logic in the while loop work as intended.

Testing

Recreated the issue:

  1. Created a new google scripts web app in personal account with code:
const doGet = (e) => ContentService.createTextOutput(JSON.stringify({ upcCode: e.parameter.upcCode })).setMimeType(ContentService.MimeType.JSON);
  1. Verified that I could access it from browser
  2. Create a new agentflow in Flowise with a HTTP node calling my WebApp exec endpoint
  3. It resulted in Request failed with status code 302

Made code change:

  1. Rebuilt flowise and ran
  2. Retried agentflow and the workflow succeeded

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @christopherholland-workday, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the flexibility of HTTP request handling by configuring Axios to accept all HTTP status codes without throwing an error. This allows the secureAxiosRequest function to uniformly process responses, providing more control over how different status codes are managed within the application's security and redirection logic.

Highlights

  • Axios Error Handling: Modified the secureAxiosRequest function to prevent Axios from automatically throwing errors for non-2xx HTTP status codes. This is achieved by setting validateStatus: () => true in the Axios request configuration.
  • Custom Status Code Validation: The change ensures that all HTTP responses, regardless of their status code, are passed through for custom handling within the secureAxiosRequest logic, rather than being treated as errors by Axios itself.
Changelog
  • packages/components/src/httpSecurity.ts
    • Updated Axios configuration to disable automatic error throwing for non-2xx status codes.
Activity
  • No activity has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@christopherholland-workday christopherholland-workday marked this pull request as draft February 24, 2026 17:39
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request addresses an issue where axios would throw an error on non-2xx responses by adding validateStatus: () => true to the currentConfig. This change ensures that all status codes are accepted, allowing the secureAxiosRequest function to handle redirects and other non-2xx responses gracefully without immediately throwing an error. This is a good change that aligns with the pull request's title and intent.

@christopherholland-workday christopherholland-workday marked this pull request as ready for review February 24, 2026 18:15
@christopherholland-workday christopherholland-workday merged commit 0fb60a3 into main Feb 24, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants