SetChecksum sets the checksum of the request.
(c Checksum)
| 339 | |
| 340 | // SetChecksum sets the checksum of the request. |
| 341 | func (p *PostPolicy) SetChecksum(c Checksum) error { |
| 342 | if c.IsSet() { |
| 343 | p.formData[amzChecksumAlgo] = c.Type.String() |
| 344 | p.formData[c.Type.Key()] = c.Encoded() |
| 345 | |
| 346 | policyCond := policyCondition{ |
| 347 | matchType: "eq", |
| 348 | condition: fmt.Sprintf("$%s", amzChecksumAlgo), |
| 349 | value: c.Type.String(), |
| 350 | } |
| 351 | if err := p.addNewPolicy(policyCond); err != nil { |
| 352 | return err |
| 353 | } |
| 354 | policyCond = policyCondition{ |
| 355 | matchType: "eq", |
| 356 | condition: fmt.Sprintf("$%s", c.Type.Key()), |
| 357 | value: c.Encoded(), |
| 358 | } |
| 359 | if err := p.addNewPolicy(policyCond); err != nil { |
| 360 | return err |
| 361 | } |
| 362 | } |
| 363 | return nil |
| 364 | } |
| 365 | |
| 366 | // SetEncryption - sets encryption headers for POST API |
| 367 | func (p *PostPolicy) SetEncryption(sse encrypt.ServerSide) { |