square/retrofit — pull request #183 by codebutler (2013-04-16 21:17:14+00:00)
Title: Issues with new multi-part implementation

I ran into two issues with the new multi-part implementation, both of which broke compatibility with an API I'm integrating with:

* **Content-Length is not sent.** I was getting a `411 Length Required` error. The attached patch works but isn't great because it requires writing out the content twice.

* **Can't set filename parameter for non-TypedFile parts** The server uses "carrierwave", which was blowing up without a filename. I created an interface that can be implemented along with TypedOutput. For example:

```java
private static class NamedTypedByteArray extends TypedByteArray implements NamedOutput {
private final String mFileName;

public NamedTypedByteArray(String fileName, String mimeType, byte[] bytes) {
super(mimeType, bytes);
mFileName = fileName;
}

@Override
public String fileName() {
return mFileName;
}
}
```

Let me know what you think.