Skip to content

Commit eebfd91

Browse files
fixed WOQL.post function
Signed-off-by: NeelParihar <[email protected]>
1 parent 0a7bdae commit eebfd91

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

lib/query/woqlQuery.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,11 +448,11 @@ WOQLQuery.prototype.remote = function(uri, opts) {
448448
return this
449449
}
450450

451-
WOQLQuery.prototype.post = function(fpath, opts) {
451+
WOQLQuery.prototype.post = function(fpath, opts, source = 'file') {
452452
//if (fpath && fpath == 'args') return ['file', 'format']
453453
if (this.cursor['@type']) this.wrapCursorWithAnd()
454-
this.cursor['@type'] = 'PostResource'
455-
this.cursor['source'] = {'@type': 'Source', 'file': fpath}
454+
this.cursor['@type'] = 'QueryResource'
455+
this.cursor['source'] = {'@type': 'Source', [source]: fpath}
456456
this.cursor['format'] = "csv" // hard coded for now
457457
this.cursor['options'] = opts
458458
if (typeof opts != 'undefined')

lib/woql.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,12 +368,13 @@ WOQL.file = function(url, formatObj) {
368368
* HTTP POST request, with the format defined through the options
369369
* @param {string} url - The Path on the server at which the file resource can be accessed
370370
* @param {typedef.DataFormatObj} [formatObj] - imput options, optional
371+
* @param {string} [source] - It defines the source of the file, it can be 'url','file','post'
371372
* @returns {WOQLQuery} A WOQLQuery which contains the Post resource identifier
372373
* @example
373-
* post("/.../.../", {type:'csv'})
374+
* post("/.../.../", {type:'csv'}, 'file')
374375
*/
375-
WOQL.post = function(url, formatObj) {
376-
return new WOQLQuery().post(url, formatObj)
376+
WOQL.post = function(url, formatObj, source) {
377+
return new WOQLQuery().post(url, formatObj, source)
377378
}
378379

379380
/**

0 commit comments

Comments
 (0)