Home > widget-integration > InstantSearchAPI > handleWidgetResponse
InstantSearchAPI.handleWidgetResponse() method
Handle a raw suggestion API response before returning it to the service.
Delegates to enrichWidgetResponse(), giving TS teams a clean hook to intercept and modify results without overriding the entire getSuggestions() method.
Signature:
protected handleWidgetResponse(response: SuggestionResponse): SuggestionResponse;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
response |
Raw suggestion response normalised from the API payload |
Returns:
Enriched suggestion response
Example
window.boostWidgetIntegration.extend('InstantSearchAPI', (InstantSearchAPI) => {
return class CustomAPI extends InstantSearchAPI {
protected handleWidgetResponse(response) {
// Log every API response for diagnostics
console.log('[ISW] response rid:', response.meta?.rid);
return super.handleWidgetResponse(response);
}
};
});