lzell / AIProxySwift

Client for AIProxy
https://www.aiproxy.pro
73 stars 9 forks source link

Add option to set content type and headers when creating custom request #64

Closed teameh closed 4 weeks ago

teameh commented 4 weeks ago

I need to set the content type and an accept header in order for calls to api.neets.ai to succeed.

When drafting this PR I found out I could of course also just do:

var request = try await AIProxyType.request(...)
request.addValue("audio/wav", forHTTPHeaderField: "accept")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")

Ah well.. feel free to close or merge this :D

teameh commented 4 weeks ago

Not sure where you want this tested though.. AIProxyURLRequest.create seems not tested directly

lzell commented 4 weeks ago

Nice contribution, thank you @teameh ! Available in release 0.38.0 https://github.com/lzell/AIProxySwift/releases/tag/v0.38.0