LoginSignup
0
0

More than 5 years have passed since last update.

ofxHttpUtilsでのFile送信でContent-Typeを指定する

Posted at

ofImageでSaveした画像をPOSTしようとしたときに、Content-Typeがapplication/octet-streamとなっていて、サーバ側のバリデーションに引っかかってしまったので、その時に行った対応のメモです。

ofxHttpUtils

結論からいうと、ofxHttpUtilsのメソッドにContent-Typeの書き換えはなかったので、ofxHttpUtils.cppの書き換えで対応しました。

276行目付近にある下記の記述を

Before

pocoForm.addPart(it->first,new FilePartSource(it->second));

After

pocoForm.addPart(it->first,new FilePartSource(it->second, "image/png"));

と変更しました。
Pocoの FilePartSource の第二引数がContent-Typeの指定なのでそれを足しています。

以上ニッチな内容ですが参考になれば幸いです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0