Skip to content

LIVY-1062: Handle HTTP 307 redirects for POST/DELETE in LivyConnection - #535

Closed
nileshrathi345 wants to merge 1 commit into
apache:masterfrom
nileshrathi345:master_LIVY-1062
Closed

LIVY-1062: Handle HTTP 307 redirects for POST/DELETE in LivyConnection#535
nileshrathi345 wants to merge 1 commit into
apache:masterfrom
nileshrathi345:master_LIVY-1062

Conversation

@nileshrathi345

@nileshrathi345 nileshrathi345 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Handle HTTP 307 Temporary Redirect in LivyConnection.sendRequest() so the Java HTTP client (client-http) retries POST, DELETE, and multipart requests to the Location URL instead of failing with IOException: Temporary Redirect.

Apache HttpClient follows redirects automatically for GET, but not for non-idempotent methods. LivyConnection.sendRequest() previously treated any non-200 response as fatal, so POST/DELETE/multipart calls failed whenever the server returned 307.

Also validates that Location is present/non-empty and consumes the redirect response entity before retry.

JIRA: LIVY-1062

How was this patch tested?

Unit tests in LivyConnectionSpec:

  • Happy path: POST (JSON), DELETE, and multipart POST via a mock standby server returning 307 to an active server — verifies method, headers (X-Requested-By), body, and response type are preserved.
  • Failure paths: missing/empty Location, redirect loop, non-redirect 404.

Was this patch authored or co-authored using generative AI tooling?

Yes, this was co-authored using Cursor to write the new test cases.

Generated-by: Cursor Composer, Cursor 3.13.21

@nileshrathi345 nileshrathi345 changed the title LIVY-1062: Livy Java HTTP client does not follow redirects for POST/DELETE in HA mode LIVY-1062: Handle HTTP 307 redirects for POST/DELETE in LivyConnection Jul 29, 2026
@nileshrathi345

Copy link
Copy Markdown
Contributor Author

Closing PR as this is more likely related to HA part which is not supported yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant