Questions tagged [interceptor]
The interceptor design pattern allows logic to be "inserted" before, during or after the execution of a piece of code, such as a method.
2,668
questions
0
votes
0
answers
22
views
Spring AOP: How to invoke code before transactional method invocation, but after transaction begin?
We need to perform some operations just before any transactional method invocation (insert*, update*, ...), BUT - it's important - after the transaction begin.
We used to do it for years in that way:
...
0
votes
0
answers
18
views
time-out in nest js interceptor
import { Injectable, NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common';
import { Observable, of } from 'rxjs';
import { tap } from 'rxjs/operators';
import { CacheService } from '....
1
vote
0
answers
65
views
using async/await with gRPC Interceptors problem
There are many different examples for making gRPC interceptor async, but all of them are post-processing interceptors. For example
public class ErrorHandlerInterceptor : Interceptor
{
public ...
2
votes
0
answers
49
views
Dio Interceptor Issue: Handling 401 Responses and Refreshing Access Token
I'm facing an issue with the Dio package in my Flutter app. I have implemented an interceptor to add headers to every request and to handle 401 response by simply logging out. However, the ...
1
vote
1
answer
102
views
Angular v16 Standalone component not working with Interceptor?
Angular version 16, MoneyComponent is a standalone component.
Application structure is
src\app\pages\money. Only one page moneyForms needs interceptor to send in additional info to API HttpPost, so ...
1
vote
1
answer
72
views
Angular HTTPInterceptor is not detected
I am trying to create an angular app that will do requests to the ASP NET CORE WEB API using JWT tokens, I set up a httpinterceptor, but it doesn't seem to work - it doesn't add headers to the ...
0
votes
0
answers
128
views
Next 14, Axios Interceptors for Refresh Token using next-auth - New Problem
I'm currently facing an issue while trying to implement an Axios interceptor for handling refresh tokens in a Next.js 14 application using Next-Auth. The problem seems to have surfaced after the ...
0
votes
0
answers
26
views
Access token interceptor using axios first request missing from failed queue
Im using axios interceptor to check error if its 401 then i refresh the token, to handle parallel queries i implemented a queue that when the token is refreshed it calls all queries in the queue, this ...
0
votes
2
answers
69
views
Can I use axios interceptors to replace an API request with local storage data?
I have an api client in my application with some interceptors:
const api = new OpenAPIClientAxios({...})
const client = api.initSync()
client.interceptors.request.use(...)
client.interceptors.response....
0
votes
1
answer
71
views
Axios interceptor doesnt immediately navigate to error page with `useNavigation`
I use axios in my React project. In the interceptor when I find server error, I navigate to error page with useNavigate. My code looks like this.
export const AxiosInstanceProvider: FC<...
-1
votes
0
answers
19
views
How do I apply an interceptor to all requests except for one (JWT access/refresh logic)?
I'm building an Ionic 7, REact 18 application with JWT access/refresh token authentication. I would like to apply an access token as an "Authorization" header to all requests, except the ...
0
votes
1
answer
57
views
Quarkus - ContextNotActiveException when injecting a request scoped bean in Interceptor
I've got a Quarkus application. The entry point to trigger this application is a class which implements AWS RequestHandler.
Before it runs I would like to set the context depending on the given ...
0
votes
2
answers
98
views
Error: Bad state: The FormData has already been finalized. This typically means you are using the same FormData in repeated requests
Am trying to upload an image to server, but when its making the request its calls the interceptor to refreshToken after getting the token it will throw this error:
[ERROR:flutter/runtime/...
0
votes
1
answer
36
views
How to encrypt response body from nestJS interceptor?
I am not able to get Body in interceptor.
This is from one of the controller.
masterData.controller.ts
const data = await this.masterDataService.fetchWorkExperienceData();
return res.status(...
0
votes
0
answers
55
views
How to implement usage of refresh token with next-auth
I'm currently working with a backend that uses Django, DRF, and simple_jwt for authorization. On the frontend, I have React, Next.js, and next-auth. I've successfully implemented the retrieval of the ...
3
votes
1
answer
279
views
X-XSRF-TOKEN header automatic generation in [email protected]
I get frustrated populating the X-XSRF-TOKEN header based on the value of the XSRF-TOKEN cookie, and then send the request to a trusted host.
That issue comes with the breaking change in axios library ...
1
vote
1
answer
30
views
How can I prevent ResponseInterceptors from executing when using a RequestErrorInterceptor in Ballerina?
I'm looking to implement a RequestErrorInterceptor to handle errors occurring in Ballerina HTTP request interceptors.
Within this error interceptor, I aim to generate an error response message and ...
0
votes
0
answers
41
views
How to intercept method calls in Unity (game engine)
I have many types with many methods with the same signature and the same body in my project. all of them pack (serialize) their arguments, send them to the server, wait for the result, and unpack the ...
0
votes
0
answers
18
views
ClientInterceptor and Firebase IdToken
I am usign GRPC service and I am trying to extends ClientInterceptor to append some headers and ask to Firebase to give me a IdToken but I don't understand how can do it because task.getResult() go to ...
0
votes
0
answers
14
views
Spring Boot: Dependency Injection Issue - GameService not Initialized in CustomHandShakeInterceptor
I'm trying to control Websocket connection. So, I implemented a customHandShakeInterceptor.
For some reason it is not creating instance of my service.
@Component
public class ...
1
vote
0
answers
43
views
Angular how to get XSRF-TOKEN cookie
Hi i want to add CSRF protection to my app
I have an angular app in front and spring in backend
In backend i have this configuration
.csrf(csrf -> csrf.csrfTokenRepository(getCsrfTokenRepository()...
0
votes
0
answers
46
views
Propagate header for a feign method, inside an async call
hope you are all doing well.
I have a RequestInterceptor, which captures my Authorization Header and propagates it forwarr:
@Component
public class FeignAuthHeaderInterceptor implements ...
0
votes
0
answers
78
views
Angular-Interceptor: Cancel outgoing http requests on access token expiration and retry them on completion
I have implemented a way to retry failed requests in my project using a queue to intercept requests that happen while a token is refreshing to store them and retry them on successful refresh. This ...
0
votes
0
answers
65
views
How can one determine order of execution of ChannelInterceptors in Spring messaging?
The problem I'm having is with the execution order of ChannelInterceptors.I tried setting up websocket security. Defined a ChannelInterseptor to implement jwt token based authentication and added its ...
0
votes
0
answers
32
views
Interceptor not wrapping JAX-RS sub-resource endpoint methods
Payara 5, Jersey 2.37, JAX-RS 2.1
I'm attempting to create a logging "transaction," where a REST endpoint (either sub-resource method or terminal endpoint - I'll demonstrate both below) is ...
0
votes
1
answer
33
views
Automatically close EntityManager in an interceptor
I have a ejb + REST application using jakarta ee 10, deployed in a Wildfly 29 server; the application uses multitenancy. When a user logs in, i have to check which database the user is going to use to ...
0
votes
0
answers
37
views
AnnotationUtils.findAnnotation not gives path value when restMethod uses GetMapping
I was trying to setup usage of REST APIs in one of our application. SO I was trying to achieving this with interceptor approach.
The problem i was having as we are having two kinds of restful ...
0
votes
1
answer
55
views
How to track error, count it and send it to Google Analytics
I've an interceptor that redirects to route /page-error on every api error
return next.handle(request.clone()).pipe(
catchError((err: any) => {
this.router.navigate(['/page-error']...
0
votes
1
answer
216
views
Multipart: Unexpected end of form with nestjs
@Post()
@Roles('USER', 'ADMIN')
@ApiBody({
description: 'Upload file',
type: 'object',
required: true,
})
@UseInterceptors(FileInterceptor('file'))
@ApiConsumes('multipart/form-...
0
votes
1
answer
65
views
NullInjectorError on a interceptor Angular 16
I'm creating a new interceptor on an Angular 16 project, and when trying to inject MatSnackBar, I'm getting the following error:
NullInjectorError: NullInjectorError: No provider for MatSnackBar!
I ...
1
vote
1
answer
165
views
EF Core SaveChangesInterceptor primary key next value
I have implemented SavingChangesAsync from the ISaveChangesInterceptor interface. I am unable to determine what primary key for the record being saved because it has not been committed. I also tried ...
1
vote
1
answer
67
views
Hook construction of objects
I am trying to intercept the construction of all objects.
function inheritFrom(){
this.property = 'Example'
}
let inheritedObject = new inheritFrom()
Whenever an object instantiation happens, I ...
0
votes
0
answers
20
views
Managing subscription in interceptor. Angular
I want to write intercepter that refresh JWT token. The question is : how I should unsubscribe from return this.authService.refreshToken(token)? And do I understand that right, that switchMap only ...
0
votes
0
answers
68
views
Error while parsing JSON Object in Android
In my Android application, I want to fetch the details of the user's profile using the token that is sent in the header format, but I get the following errors
Specify the JSON Parsing Error:
java.io....
0
votes
0
answers
29
views
Calling browser.SetupInterceptor() before Browser.url(), but getting Error
Scenario: I have a WebApp with a URL "xyz.com", As soon as this URL is loaded on the URL bar (through browser.url()), a few APIs will get triggered (say the name as /ab,/bc and /cd API's), ...
0
votes
1
answer
67
views
TypeLoadException: Type 'Castle.Proxies.IComponentProxy' from assembly 'DynamicProxyGenAssembly2' is attempting to implement an inaccessible interface
I would like to log the calling of user interface methods.
My idea is to intercept the MyUserInterface class which inherits from System.Windows.Forms.Form.
However, I got TypeLoadException: Type '...
1
vote
1
answer
99
views
Custom interceptor in quarkus mutiny web client
I am using Quarkus and Mutiny in test application.
Creating the web client like below which will be used to interact with other micro services.
https://smallrye.io/smallrye-mutiny-vertx-bindings/2.16....
0
votes
0
answers
39
views
Can keyboard binary inputs mimic Xbox analog sticks by using key press "rates" to approximate tilt? (I'm using Keyboardsplitter Github project to try)
I'm currently focused on addressing the X-axis aspect of the left thumbstick emulation for an Xbox controller using a keyboard. I've come across a GitHub project that offers the capability to mimic an ...
0
votes
0
answers
17
views
Node.js Multiple concurrent request at the same time
Greetting everyone!
I need help with something, currently I'm developing a API in node.js, that make a lot of requests to other apis, and I need to collect the time that each request takes to execute, ...
1
vote
3
answers
103
views
How to always apply a method before executing another method via a proxy?
I have the following code where I want to invoke the instance method connect before proceeding with the invocation of every other instance method of the TelegramClient class. How can this be achieved ...
0
votes
1
answer
152
views
Nestjs ClassSerializerInterceptor doesn't work
I want ClassSerializerInterceptor to make my response body match response type, currently it doesn't work and still returns all the fields that are returned from function.
Example of my response DTO:
...
0
votes
0
answers
11
views
How write test for logics in retry function on Alamofire.Interceptor
I use the Alamofire.Interceptor to handle refresh token and retry some API calls and I have a lot of logic and if / else's on this network interceptor class.
I wonder how I can write unit test for ...
0
votes
0
answers
20
views
Add HTTP headers to SOAP request with data from external API using Interceptor
I am attempting to implement a logic where I add some HTTP headers to my SOAP request before sending the request onwards to the target webservice. More specifically I am attempting to implement ...
0
votes
0
answers
233
views
NestJS axios interceptor
I'm working on a project in NestJS where I need to communicate with an external API. I've created an Axios interceptor to handle authentication. So far, this has been working on a simple POST endpoint ...
0
votes
0
answers
12
views
How to use a cookie from interceptor as env variable?
I'm trying to use a cookie from interceptor as env variable to use it as Bearer token but all solutions I got tell me to use them from response and there is no cookie there, I need to set the cookie ...
0
votes
0
answers
40
views
Axios Interceptor: return own response without making the call to the backend
In my axios interceptor I have a case where I have multiple cached requests in an array and I want to "answer" them with a fake response and set a custom http status message to signal the ...
0
votes
0
answers
14
views
Code to intecept api calls to internal resources
I wrote the below code to intercept all the http requests in my application. But, The below code only intercepts calls to external apis, but not api calls to internal resources. Can some one tell me ...
0
votes
0
answers
62
views
Intercept an ngModel binding with an Angular Directive
I ask myself if it possible to intercept an ngModel binding with an Angular directive.
For example:
template:
<input type="string" [(ngModel)]="numberVal" name="someName&...
0
votes
1
answer
27
views
How to apply interceptor in Angular only to POST requests? [closed]
Is it possible to apply interceptors in Angular only to POST requests?
0
votes
1
answer
84
views
How to disable Interceptors for 1 request in React?
I have Interceptors.js file under src file. I am importing it in the files which I need. But it is also working for 1 request which I do not want to use the Interceptors even I do not import it. How ...