Skip to content

Fix REST API docs request interceptor URL replacement#3196

Merged
tom2drum merged 1 commit intomainfrom
tom2drum/rest-api-host-fix
Dec 23, 2025
Merged

Fix REST API docs request interceptor URL replacement#3196
tom2drum merged 1 commit intomainfrom
tom2drum/rest-api-host-fix

Conversation

@tom2drum
Copy link
Copy Markdown
Collaborator

@tom2drum tom2drum commented Dec 22, 2025

Description and Related Issue(s)

Fixes the request interceptor in the REST API documentation snippet to correctly replace default server URLs. The previous implementation chained .replace() calls which could cause incorrect URL replacements when both default server patterns were present in the URL (for example, https://megaeth.blockscout.com).

Proposed Changes

  • Fixed the request interceptor logic in ui/apiDocs/utils.ts to check which default server URL is present before performing the replacement, ensuring only the correct server URL is replaced
  • Updated MEGA network configuration from testnet to mainnet in configs/envs/.env.mega_eth and tools/preset-sync/index.ts

Breaking or Incompatible Changes

None.

Additional Information

The fix ensures that when the REST API documentation makes requests, it correctly replaces the default server URLs (blockscout.com/poa/core or eth.blockscout.com) with the configured API host, preventing potential URL replacement errors.

Checklist for PR author

  • I have tested these changes locally.
  • I added tests to cover any new functionality, following this guide
  • Whenever I fix a bug, I include a regression test to ensure that the bug does not reappear silently.
  • If I have added, changed, renamed, or removed an environment variable
    • I updated the list of environment variables in the documentation
    • I made the necessary changes to the validator script according to the guide
    • I added "ENVs" label to this pull request

@tom2drum tom2drum added the bug Something isn't working label Dec 22, 2025
@tom2drum tom2drum merged commit d6e3f73 into main Dec 23, 2025
11 checks passed
@tom2drum tom2drum deleted the tom2drum/rest-api-host-fix branch December 23, 2025 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant