locationConstraint parses the request body (if present). If there is no body, an empty string will be returned.
(a *action)
| 697 | // locationConstraint parses the <CreateBucketConfiguration /> request body (if present). |
| 698 | // If there is no body, an empty string will be returned. |
| 699 | func locationConstraint(a *action) string { |
| 700 | var body bytes.Buffer |
| 701 | if _, err := io.Copy(&body, a.req.Body); err != nil { |
| 702 | fatalError(400, "InvalidRequest", "%v", err.Error()) |
| 703 | } |
| 704 | if body.Len() == 0 { |
| 705 | return "" |
| 706 | } |
| 707 | var loc CreateBucketConfiguration |
| 708 | if err := xml.NewDecoder(&body).Decode(&loc); err != nil { |
| 709 | fatalError(400, "InvalidRequest", "%v", err.Error()) |
| 710 | } |
| 711 | return loc.LocationConstraint |
| 712 | } |