Skip to content

proxy 的 onRequest 有沒有方法像 hook 一樣整個bypass? #118

Open
@cyfung1031

Description

hook有這個

  onreadystatechange:function(xhr,event){
    console.log("onreadystatechange called: %O")
    //返回false表示不阻断,拦截函数执行完后会接着执行真正的xhr.onreadystatechange回调.
    //返回true则表示阻断,拦截函数执行完后将不会执行xhr.onreadystatechange. 
    return false
  },

如果我想在proxy中onRequest像上面一個整個bypass不進入任何onResponse onError, 有方法嗎
(連handler.next(config)都不跑,直接原生較快也不會對我不處理的request出現bug)

ah.proxy({
            onRequest: (config, handler) => {
                 if(config.url == 'xxxxxxxx'){
                        // handler.bypass()??
                  }
                  // handler.next(config)
            },
             ...
})

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions