Merge pull request #1596 from deepak1556/protocol_interceptor_patch
protocol: wrapping HttpJobFactory with a default protocol handler to intercept
This commit is contained in:
commit
4129d45d21
5 changed files with 95 additions and 0 deletions
|
@ -205,3 +205,31 @@ describe 'protocol module', ->
|
|||
assert false, 'Got error: ' + errorType + ' ' + error
|
||||
free()
|
||||
protocol.interceptProtocol 'file', handler
|
||||
|
||||
it 'can override http protocol handler', (done) ->
|
||||
handler = remote.createFunctionWithReturnValue 'valar morghulis'
|
||||
protocol.once 'intercepted', ->
|
||||
protocol.uninterceptProtocol 'http'
|
||||
done()
|
||||
protocol.interceptProtocol 'http', handler
|
||||
|
||||
it 'can override https protocol handler', (done) ->
|
||||
handler = remote.createFunctionWithReturnValue 'valar morghulis'
|
||||
protocol.once 'intercepted', ->
|
||||
protocol.uninterceptProtocol 'https'
|
||||
done()
|
||||
protocol.interceptProtocol 'https', handler
|
||||
|
||||
it 'can override ws protocol handler', (done) ->
|
||||
handler = remote.createFunctionWithReturnValue 'valar morghulis'
|
||||
protocol.once 'intercepted', ->
|
||||
protocol.uninterceptProtocol 'ws'
|
||||
done()
|
||||
protocol.interceptProtocol 'ws', handler
|
||||
|
||||
it 'can override wss protocol handler', (done) ->
|
||||
handler = remote.createFunctionWithReturnValue 'valar morghulis'
|
||||
protocol.once 'intercepted', ->
|
||||
protocol.uninterceptProtocol 'wss'
|
||||
done()
|
||||
protocol.interceptProtocol 'wss', handler
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue