mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 03:27:54 +00:00
http/logical: Add http GET parameters to the data map (#4012)
* Add get parameters to the data object * Add test for get params
This commit is contained in:
@@ -75,6 +75,30 @@ func buildLogicalRequest(core *vault.Core, w http.ResponseWriter, r *http.Reques
|
||||
}
|
||||
}
|
||||
|
||||
// If we are a read operation, try and parse any parameters
|
||||
if op == logical.ReadOperation {
|
||||
getData := map[string]interface{}{}
|
||||
|
||||
for k, v := range r.URL.Query() {
|
||||
// Skip the help key as this is a reserved parameter
|
||||
if k == "help" {
|
||||
continue
|
||||
}
|
||||
|
||||
switch {
|
||||
case len(v) == 0:
|
||||
case len(v) == 1:
|
||||
getData[k] = v[0]
|
||||
default:
|
||||
getData[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
if len(getData) > 0 {
|
||||
data = getData
|
||||
}
|
||||
}
|
||||
|
||||
var err error
|
||||
request_id, err := uuid.GenerateUUID()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user