elements icon indicating copy to clipboard operation
elements copied to clipboard

Allow to intercept try it request

Open tmkasun opened this issue 2 years ago • 5 comments

User story.

As a developer I want to intercept the outgoing tryout HTTP request So that I can Inject / Update HTTP request parameters such as headers

UPDATE:

The above user story is actually kind of intermediate requirement, My final goal is to auto-populate the Authentication parameters

image

so, As an API Consumer I want to set my authentication parameter automatically So that I can avoid coping the parameters (I:e API Key, Bearer token) manually

Is your feature request related to a problem?

I can't add to change the Authorization header value or Add a custom HTTP header to the TryIt request

UPDATE:

As per the updated user story, My problem is, I can set the Authentication parameters programmatically, No prop or API in the Elements component to set the Operation Auth Value (operationAuthValue)

Describe the solution you'd like

Expose a request interceptor interface, to modify this tryit fetch request parameters.

Additional context

As an example, In Swagger-UI library they expose a requestInterceptor parameter that users(library) can use to intercept any HTTP requests initiated from the swagger UI.

tmkasun avatar Nov 14 '21 17:11 tmkasun

Hey @tmkasun, exciting that WSO2 is evaluating elements for usage in dev portals. Can we setup a call to go through what you're looking to do and how we can possibly collaborate?

mnaumanali94 avatar Nov 15 '21 15:11 mnaumanali94

Hi @mnaumanali94 , Yeah that's great, Let's have a call, I sent a meeting invitation to your github email, Let me know whether that timeslot works for you, Else feel free to re-schedule the call.

tmkasun avatar Nov 16 '21 18:11 tmkasun

Are there any updates to this feature request by any chance?

moon0326 avatar Jul 18 '22 21:07 moon0326

Hi @moon0326 ,

I check the latest code in the TryIt.tsx. It seems like now we can change the request parameters via onRequestChange prop. Haven't tested it though, So we might able to use that callback function to get to the request headers. @mnaumanali94 can you shed some light on this ?

tmkasun avatar Jul 19 '22 04:07 tmkasun

Thank you! I did not notice that. I'll look into it :)

moon0326 avatar Jul 19 '22 05:07 moon0326