-
Notifications
You must be signed in to change notification settings - Fork 657
Open
Description
Hello,
I am trying to upload image to etsy with this package. I did the following for performing the operation.
` public async post(path: string, params: any, content: any, type: any) {
var url: string;
url = this.buildUrl(path, params);
if (!this.authToken || !this.authSecret)
throw new Error("Invalid or missing Token or Secret");
console.log(type)
let response: any = await new Promise((resolve, reject) => {
return this.oauth.post(url, this.authToken, this.authSecret, content, type || false, function (err: any, data: any, response: any) {
if (err) {
return reject(err);
}
return resolve({ res: response, data: data });
});
});
if (!response)
throw new Error("Invalid response for request performed, please try again");
return await this.handleResponse(response.res, response.data);
};`
the content passed to oauth.post is
{ name: __dirname + '/images/article-3.png', mime: 'image/jpeg', postname: 'article-3' }
Since the content type of content is not string and in library i saw this code
if ( typeof post_body != "string" && !Buffer.isBuffer(post_body) ) { post_content_type= "application/x-www-form-urlencoded" extra_params= post_body; post_body= null; }
my post content type is always application/x-www-form-urlencoded and i always get
oauth_problem=signature_invalid
problem.
Can any one please provide me a sample code to upload a file with this oauth library to any api. Thanks.
Veraxusoguzhanbulut
Metadata
Metadata
Assignees
Labels
No labels