----------------------------------------------------------------------------- Pre-processing for a request
(username, path string, req *http.Request)
| 63 | |
| 64 | // Pre-processing for a request |
| 65 | func processRequest(username, path string, req *http.Request) (bool, string) { |
| 66 | if limiter == nil || !limiter.isActive() { |
| 67 | // rateLimiter not active |
| 68 | return true, "" |
| 69 | } |
| 70 | |
| 71 | // evaluate requests at endpoints .. |
| 72 | // index creation/update/deletion: /api/index/{indexName} |
| 73 | // search request: /api/index/{indexName}/query |
| 74 | if path != indexPath && path != queryPath { |
| 75 | return true, "" |
| 76 | } |
| 77 | |
| 78 | return limiter.processRequest(username, path, req) |
| 79 | } |
| 80 | |
| 81 | // Post-processing after a response is shipped for a request |
| 82 | func completeRequest(username, path string, req *http.Request, egress int64) { |
no test coverage detected