FlexibleChecksumsRequestInterceptor

class FlexibleChecksumsRequestInterceptor(requestChecksumRequired: Boolean, requestChecksumCalculation: <Error class: unknown class>?, requestChecksumAlgorithm: String?) : CachingChecksumInterceptor

Handles request checksums for operations with the HttpChecksumTrait applied.

If a user supplies a checksum via an HTTP header no calculation will be done. The exception is MD5, if a user supplies an MD5 checksum header it will be ignored.

If the request configuration and model requires checksum calculation:

  • Check if the user configured a checksum algorithm for the request and attempt to use that.

  • If no checksum is configured for the request then use the default checksum algorithm to calculate a checksum.

If the request will be streamed:

  • The checksum calculation is done during transmission using a hashing & completing body.

  • The checksum will be sent in a trailing header, once the request is consumed.

If the request will not be streamed:

  • The checksum calculation is done before transmission

  • The checksum will be sent in a header

Business metrics MUST be emitted for the checksum algorithm used.

Parameters

requestChecksumRequired

Model sourced flag indicating if checksum calculation is mandatory.

requestChecksumCalculation

Configuration option that determines when checksum calculation should be done.

requestChecksumAlgorithm

The checksum algorithm that the user selected for the request, may be null.

Constructors

Link copied to clipboard
constructor(requestChecksumRequired: Boolean, requestChecksumCalculation: <Error class: unknown class>?, requestChecksumAlgorithm: String?)

Functions

Link copied to clipboard
open override fun applyChecksum(context: <Error class: unknown class><Any, <Error class: unknown class>>, checksum: String): <Error class: unknown class>
Link copied to clipboard
open suspend override fun calculateChecksum(context: <Error class: unknown class><Any, <Error class: unknown class>>): String?
Link copied to clipboard
open suspend override fun modifyBeforeSigning(context: <Error class: unknown class><Any, <Error class: unknown class>>): <Error class: unknown class>