agoda-com / agoda-com/ninjato

Example of uploading raw binary data file using Ninjato

未關閉
#16 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
enhancement
主要語言
Kotlin
星號
114
分支
9
PR 合併指標
30 天內沒有已合併 PR

描述

# Question

I've been working with Ninjato for non-upload calls for a couple weeks now, and it works great! Very flexible and does everything I've needed with intercepting responses and retry logic and everything.

However, I can't seem to figure out how to construct a MultiPartEntity / MultiPart Body like I've used before in Apache's old HTTP libraries and add it to the Ninjato Body object. I see the okhttp MultiPartBody but I'm not sure a) how to use this with Ninjato's Body object, and b) not sure how to `addBinaryPart()` like I did in Apache (see below method I am looking for in Ninjato)

```
public MultipartEntityBuilder addBinaryBody(String name, byte[] b, ContentType contentType, String filename) {
return this.addPart(name, new ByteArrayBody(b, contentType, filename));
}
```

# Suggestion (Optional)

If this doesn't already exist in the sample app / sample code or docs, can it be added? I must be missing something.

# Environment

I am using version `0.3.1` which is indicated to be the latest version both in the `README.md` and at maven central. I am working in Kotlin wherever possible but I am interfacing with a fair amount of existing Java as well.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。