ohcnetwork / journal

MIT License
8 stars 12 forks source link

Visits list api not working - after second visit #50

Closed amaljosea closed 4 years ago

amaljosea commented 4 years ago

Seems like Apis /api/v1/visits/ongoing and /api/v1/visits not working for some scenarios.

user has no visit - api is working user has 1 visit - api is working user has 2 visit - api is not working user has more than 2 visits - api is not working

Originally posted by @amaljosea in https://github.com/coronasafe/journal/issues/45#issuecomment-660444731

unnitallman commented 4 years ago

@amaljosea _a

Please watch this and get back https://share.getcloudapp.com/wbuWlAnv

amaljosea commented 4 years ago

@unnitallman Please check this video

https://drive.google.com/file/d/1MVT3q9ZZ1FnFWY-ULeQt-Avs3OZnlu3J/view

agneym commented 4 years ago

I can confirm this is happening, it seems to be connected to the gzip module. curl also fails when using the User-Agent header.

josephv7 commented 4 years ago

I was able to get the response by commenting the contents of config/initializers/rack_deflater.rb.

@unnitallman @agneym

unnitallman commented 4 years ago

@agneym could you post the full curl line, so that i can reproduce it and try to fix it.

unnitallman commented 4 years ago

@josephv7 Good one. @agneym @amaljosea Please use @josephv7 's solution for now, I will try and fix it properly tomorrow.

agneym commented 4 years ago

@unnitallman Copied from browser

curl 'http://localhost:3000/api/v1/visits/ongoing' \
  -H 'Connection: keep-alive' \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'X-Auth-Token: PQxy3h9kUMtViLkonECT' \
  -H 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1' \
  -H 'Sec-Fetch-Site: same-origin' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Referer: http://localhost:3000/user' \
  -H 'Accept-Language: en-US,en;q=0.9,ml;q=0.8' \
  -H 'Cookie: CSRF-TOKEN=ke4e1Uif6tMB%2Bf9QeB4MEAeeM%2Fi7guCjxq74ICHDYSBiezF3AyhrQeb7UXgyXJyP6P%2FPC3OjtB5KpaWuUo%2B2qg%3D%3D; _journal_session=It2sNlMoI0gZ8O3xQRLFAQwbAMdKyzTiRvm%2Fut3Xk1F%2BVPez%2FVWeCAm6gBXFVfUCeZ1VahRdfpjxC2tlQn80e61RmU9YbPVssig6nh%2FwE69cIujEVRmdjJfum1wYuVPGQx9s%2BEwyWXZH7noC0a9bSYZ8gGK6brfPRcSv8zhOE6MBhkExxy7fxuJb9Qj6ZF6%2Bopj1KFFFWUxh2GA1Fu%2B%2B8c1UFvsPx0cu%2BjGmZobeO5I8x5uz%2BiqEkvk40CgPBIFYVKJwqE3ANbCvSDn%2Bi8bVv1erVuTZc70H2E%2F11ZAL1hKTzN9T7pEt9rIALIE5piDce6HP9bMj1YvIpWUPelRRhAppKZQ%3D--PEgkgYLGPIjXGpO6--3DasFBtT7DUJM%2BAhG4j2JA%3D%3D' \
  -H 'If-None-Match: W/"ec8fd42d6be76dfef6514d8f89f7474a"' \
  --compressed
unnitallman commented 4 years ago

Fixed in #64