lakenen / node-box-view

A node client for the Box View API
MIT License
13 stars 2 forks source link

`non_svg` option is broken for `uploadFile` #3

Closed lakenen closed 10 years ago

lakenen commented 10 years ago

The option is being appended to the form as a boolean value, and the form-data api seems to send these values directly into a Buffer, which expects a string or number.

sunil12345 commented 9 years ago

HI lakenen

I am struggling for the issue how to pass non_svg attribute to box from apex. I have used in setHeader methods in httpRequest and inother places also butnot able to get the proper response. Here is the small code snippet Can you please provide some help.

Thanks

lakenen commented 9 years ago

@sunil12345 it looks like your code snippet didn't show up. Could you show me what code you're using?

sunil12345 commented 9 years ago
    //String header = '--'+boundary+'\nContent-Disposition: form-data;

name="file";filename="'+file.name+'";\nContent-Type: multipart/form-data';

    //header = header+'\nnon_svg='+True ;

    String header = '--'+boundary+'\nContent-Disposition: form-data;

name="file";filename="'+file.name+'";\nContent-Type: application/octet-stream';

    //String header = '--'+boundary+'\nContent-Disposition: form-data;

name="file"; filename="'+file.name+'";\nContent-Type: multipart/form-data;'+'\nnon-svg='+True;

    String footer = '--'+boundary+'--';

    String headerEncoded =

EncodingUtil.base64Encode(Blob.valueOf(header+'\r\n\r\n'));

    HttpResponse res;

I am not able to pass non-svg true to box correctly please guide me On Feb 4, 2015 11:43 PM, "Cameron Lakenen" notifications@github.com wrote:

@sunil12345 https://github.com/sunil12345 it looks like your code snipped didn't show up. Could you show me what code you're using?

— Reply to this email directly or view it on GitHub https://github.com/lakenen/node-box-view/issues/3#issuecomment-72907226.

lakenen commented 9 years ago

Are you using node-box-view? You shouldn't have to manually manipulate headers.

For non_svg, you can simply do:

var client = require('box-view').createClient(MY_AUTH_TOKEN)
var options = {
  params: { non_svg: true }
}
client.uploadFile(someFile, options, function (response) {
  // ...
})
sunil12345 commented 9 years ago

I am notusing node- box -view. Simple box api On Feb 4, 2015 11:50 PM, "Cameron Lakenen" notifications@github.com wrote:

Are you using node-box-view? You shouldn't have to manually manipulate headers.

For non_svg, you can simply do:

var client = require('box-view').createClient(MY_AUTH_TOKEN)var options = { params: { non_svg: true } } client.uploadFile(someFile, options, function (response) { // ... })

— Reply to this email directly or view it on GitHub https://github.com/lakenen/node-box-view/issues/3#issuecomment-72908495.

lakenen commented 9 years ago

Ah. Please send a support request to api@box.com.

sunil12345 commented 9 years ago

For reference I have asked question in forum https://support.box.com/hc/en-us/requests/765117 On Feb 4, 2015 11:43 PM, "Cameron Lakenen" notifications@github.com wrote:

@sunil12345 https://github.com/sunil12345 it looks like your code snipped didn't show up. Could you show me what code you're using?

— Reply to this email directly or view it on GitHub https://github.com/lakenen/node-box-view/issues/3#issuecomment-72907226.

sunil12345 commented 9 years ago

Thanks lakenen I will do this in the morning But really thanks for your response. On Feb 4, 2015 11:53 PM, "Cameron Lakenen" notifications@github.com wrote:

Ah. Please send a support request to api@box.com.

— Reply to this email directly or view it on GitHub https://github.com/lakenen/node-box-view/issues/3#issuecomment-72908996.