Skip to Content
0
Jul 21, 2019 at 11:08 AM

How to set Content Range in REST Sender Channel?

57 Views

Hi ,

We Synchronous interface using REST sender channel and we need to return different HTTP status code bases on the result as below, so let me know if anyone worked on same.

Cases when 416 status (Requested range unsatisfiable) shall be returned:

  1. Empty list result, whatever the Range parameter
  2. Range not starting with 0 and upper range value is less than size of result (e.g. Range 5-6 and result has 5 or less items)

Cases when 206 (Partial Content) status shall be returned:

  1. Range starting with 0 and more items than requested (e.g. Range 0-4 and at least 6 elements)
  2. Range not starting with 0

On all 200/206/416 status, following Headers shall be returned:

  • Accept-Range, containing maximum accepted range (here 50)
  • Content-Range, containing returned range (Range may be 0-49 and Content-Range 0-2 is there are 3 items)