AynSiddiqui opened a new pull request, #55944:
URL: https://github.com/apache/arrow/pull/55944

   ### Rationale for this change
   
   Passing `str` headers to `FlightCallOptions(headers=...)` raises `TypeError: 
expected bytes, str found`. `ServerCallContext.add_header` and 
`ServerCallContext.add_trailer` already accept `str` by converting it to 
`bytes`.
   
   ### What changes are included in this PR?
   
   `FlightCallOptions.__init__` uses `tobytes` on each header key and value. It 
encodes `str` as UTF-8 and passes `bytes` through unchanged. Other types still 
raise `TypeError`. For example, an `int` key or value raises `TypeError: 
expected bytes, int found`.
   
   ### Are these changes tested?
   
   Yes. `test_arbitrary_headers_in_flight_call_options` runs once with `str` 
headers and once with `bytes` headers. The `str` case fails without the fix and 
passes with it.
   
   ### Are there any user-facing changes?
   
   Yes. `FlightCallOptions` now accepts both `str` and `bytes` for header keys 
and values. Existing callers that pass `bytes` get the same behavior.
   
   ### Was AI used for this PR?
   
   **PR code and description written by:**
   
   - [x] Human
   - [x] AI
   
   **Reviewed before submission by:**
   
   - [x] Human
   - [x] AI
   - [ ] Not reviewed
   
   * GitHub Issue: (filled in automatically from the PR title; change "Closes" 
to "Refs" for a partial fix)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to