Swagger 的 requestInterceptor 中的 Promise UI
Promise in requestInterceptor of Swagger UI
是否可以从 requestInterceptor return promise 对象,swagger 客户端会在调用实际 http 调用之前等待 promise returned 解析吗?
是的,这在 Swagger UI 3.13.3+. From the documentaton 中得到支持(强调我的):
requestInterceptor
Function=(a => a)
. MUST be a function. Function to intercept remote definition, Try-It-Out, and OAuth2 requests. Accepts one argument requestInterceptor(request) and must return the modified request, or a Promise that resolves to the modified request.
是否可以从 requestInterceptor return promise 对象,swagger 客户端会在调用实际 http 调用之前等待 promise returned 解析吗?
是的,这在 Swagger UI 3.13.3+. From the documentaton 中得到支持(强调我的):
requestInterceptor
Function=(a => a)
. MUST be a function. Function to intercept remote definition, Try-It-Out, and OAuth2 requests. Accepts one argument requestInterceptor(request) and must return the modified request, or a Promise that resolves to the modified request.