Skip to content

Cannot delete child route after deleting parent route #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
invisibleroads opened this issue Jan 25, 2017 · 2 comments · Fixed by #93
Closed

Cannot delete child route after deleting parent route #92

invisibleroads opened this issue Jan 25, 2017 · 2 comments · Fixed by #93

Comments

@invisibleroads
Copy link

Thanks for making this proxy!

We are finding that deleting /x before deleting /x/y causes an error.

import requests
requests.post('http://localhost:8080/api/routes/x', json={'target': 'http://localhost:5000'})
requests.post('http://localhost:8080/api/routes/x/y', json={'target': 'http://localhost:5001'})
requests.delete('http://localhost:8080/api/routes/x')
requests.delete('http://localhost:8080/api/routes/x/y')

20:01:59.255 - error: [ConfigProxy] Error in handler for DELETE /api/routes/x/y:  TypeError: Cannot read property 'remove' of undefined
    at URLTrie.remove (/usr/lib/node_modules/configurable-http-proxy/lib/trie.js:83:10)
    at ConfigurableProxy.remove_route (/usr/lib/node_modules/configurable-http-proxy/lib/configproxy.js:203:19)
    at ConfigurableProxy.delete_routes (/usr/lib/node_modules/configurable-http-proxy/lib/configproxy.js:265:14)
    at ConfigurableProxy.<anonymous> (/usr/lib/node_modules/configurable-http-proxy/lib/configproxy.js:76:27)
    at Function.<anonymous> (/usr/lib/node_modules/configurable-http-proxy/lib/configproxy.js:26:16)
    at ConfigurableProxy.handle_api_request (/usr/lib/node_modules/configurable-http-proxy/lib/configproxy.js:441:21)
    at Server.<anonymous> (/usr/lib/node_modules/configurable-http-proxy/lib/configproxy.js:154:32)
    at emitTwo (events.js:87:13)
    at Server.emit (events.js:172:7)
    at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:537:12)

However, deleting /x/y before deleting /x works as expected.

import requests
requests.post('http://localhost:8080/api/routes/x', json={'target': 'http://localhost:5000'})
requests.post('http://localhost:8080/api/routes/x/y', json={'target': 'http://localhost:5001'})
requests.delete('http://localhost:8080/api/routes/x/y')
requests.delete('http://localhost:8080/api/routes/x')
@minrk
Copy link
Member

minrk commented Jan 25, 2017

Good catch! #93 should fix it, I think.

@minrk minrk closed this as completed in #93 Jan 26, 2017
@invisibleroads
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants