Skip to content

searchApi: fix response interceptors and suggestion config validation#302

Open
bodoque-01 wants to merge 1 commit into
inveniosoftware:masterfrom
bodoque-01:fix/SearchApiInterceptors
Open

searchApi: fix response interceptors and suggestion config validation#302
bodoque-01 wants to merge 1 commit into
inveniosoftware:masterfrom
bodoque-01:fix/SearchApiInterceptors

Conversation

@bodoque-01
Copy link
Copy Markdown

@bodoque-01 bodoque-01 commented May 21, 2026

❤️ Thank you for your contribution!

Description

This PR fixes some bugs in the search API layer.

Response Interceptors

InvenioSearchApi and OSSearchApi registered config.interceptors.response on axios.interceptors.request instead of .response, so response interceptors never ran. Now, both APIs use interceptors. response.use, with tests asserting that the handler receives {status, data}.

InvenioSuggestionApi config

validateConfig was orphaned after the parent renamed validateConfig to validateAxiosConfig (commit in 2020) and was never called from the constructor path.

Query state

updateQueryStateAfterResponse deleted response.newStateQuery instead of response.newQueryState

Impact

Bundled demos (e.g. OpenSearch on localhost:5000) behave the same on the default path, I think the fixes matters only (correct me if wrong!) when anyone who uses it uses response interceptors.
Besides adding tests, I too tested manually by adding some silly mock interceptor and verified via console logs that it indeed was being included in the logic when searching.

Checklist

Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:

Frontend

Reminder

By using GitHub, you have already agreed to the GitHub’s Terms of Service including that:

  1. You license your contribution under the same terms as the current repository’s license.
  2. You agree that you have the right to license your contribution under the current repository’s license.

Register response interceptors on the axios response pipeline in
InvenioSearchApi and OSSearchApi. Call InvenioSuggestionApi.validateConfig
from initSerializers and fix the responseField error message. Delete
response.newQueryState after updating state from search results.
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.

1 participant