Content-Type header should not be overridden
iamjamesim opened this issue · 4 comments
iamjamesim commented
Bug report
Describe the bug
FunctionInvokeOptions overrides the specified Content-Type header value to application/octet-stream when body is of type Data.
To Reproduce
let boundary = "Boundary-\(UUID().uuidString)"
let contentType = "multipart/form-data; boundary=\(boundary)"
let options = FunctionInvokeOptions(
headers: ["Content-Type": contentType],
body: "binary value".data(using: .utf8)!
)
print(options.headers)
Output
["Content-Type": "application/octet-stream"]
Expected behavior
Functions are invoked with the specified Content-Type header value.
System Information
functions-swift:1.0.0
Additional context
I'm trying to invoke a function that handles multipart/form-data requests (based on this example function).
iamjamesim commented
I have a potential fix here. Happy to open a PR if it makes sense.
grdsdev commented
Hi @iamjamesim sorry for the late response.
Feel free to PR your fix, it would be of great help.
iamjamesim commented
@grdsdev please take a look at the open PR when you get a chance. Just hoping to point my projects back to this repo instead of my fork. Thanks!
grdsdev commented