Skip to content

Commit b394d62

Browse files
committed
clean up functions client
1 parent d3904cd commit b394d62

File tree

1 file changed

+3
-26
lines changed

1 file changed

+3
-26
lines changed

src/packages/functions/FunctionsClient.ts

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { DEFAULT_HEADERS } from '../../drivers/constants'
22
import { SQLiteCloudError } from '../../drivers/types'
33
import { FUNCTIONS_ROOT_PATH } from '../constants'
44
import { getAPIUrl } from '../utils'
5-
import { Fetch, resolveFetch, resolveHeadersConstructor } from '../utils/fetch'
5+
import { Fetch, resolveFetch } from '../utils/fetch'
66

77
export class FunctionsClient {
88
protected url: string
@@ -26,6 +26,7 @@ export class FunctionsClient {
2626
}
2727

2828
async invoke(functionId: string, args: any[]) {
29+
// add argument handling
2930
try {
3031
const response = await this.fetch(`${this.url}/${functionId}`, {
3132
method: 'POST',
@@ -57,29 +58,5 @@ export class FunctionsClient {
5758
}
5859

5960
/**
60-
if (
61-
functionArgs &&
62-
((headers && !Object.prototype.hasOwnProperty.call(headers, 'Content-Type')) || !headers)
63-
) {
64-
if (
65-
(typeof Blob !== 'undefined' && functionArgs instanceof Blob) ||
66-
functionArgs instanceof ArrayBuffer
67-
) {
68-
// will work for File as File inherits Blob
69-
// also works for ArrayBuffer as it is the same underlying structure as a Blob
70-
_headers['Content-Type'] = 'application/octet-stream'
71-
body = functionArgs
72-
} else if (typeof functionArgs === 'string') {
73-
// plain string
74-
_headers['Content-Type'] = 'text/plain'
75-
body = functionArgs
76-
} else if (typeof FormData !== 'undefined' && functionArgs instanceof FormData) {
77-
// don't set content-type headers
78-
// Request will automatically add the right boundary value
79-
body = functionArgs
80-
} else {
81-
// default, assume this is JSON
82-
_headers['Content-Type'] = 'application/json'
83-
body = JSON.stringify(functionArgs)
84-
}
61+
8562
*/

0 commit comments

Comments
 (0)