aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/shared/abstract-command.ts
diff options
context:
space:
mode:
Diffstat (limited to 'shared/extra-utils/shared/abstract-command.ts')
-rw-r--r--shared/extra-utils/shared/abstract-command.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/shared/extra-utils/shared/abstract-command.ts b/shared/extra-utils/shared/abstract-command.ts
index be368376f..6a9ab1348 100644
--- a/shared/extra-utils/shared/abstract-command.ts
+++ b/shared/extra-utils/shared/abstract-command.ts
@@ -1,4 +1,6 @@
1import { isAbsolute, join } from 'path'
1import { HttpStatusCode } from '@shared/core-utils' 2import { HttpStatusCode } from '@shared/core-utils'
3import { root } from '../miscs'
2import { 4import {
3 makeDeleteRequest, 5 makeDeleteRequest,
4 makeGetRequest, 6 makeGetRequest,
@@ -146,6 +148,25 @@ abstract class AbstractCommand {
146 }) 148 })
147 } 149 }
148 150
151 protected updateImageRequest (options: InternalCommonCommandOptions & {
152 fixture: string
153 fieldname: string
154 }) {
155 let filePath = ''
156 if (isAbsolute(options.fixture)) {
157 filePath = options.fixture
158 } else {
159 filePath = join(root(), 'server', 'tests', 'fixtures', options.fixture)
160 }
161
162 return this.postUploadRequest({
163 ...options,
164
165 fields: {},
166 attaches: { [options.fieldname]: filePath }
167 })
168 }
169
149 private buildCommonRequestOptions (options: InternalCommonCommandOptions) { 170 private buildCommonRequestOptions (options: InternalCommonCommandOptions) {
150 const { path } = options 171 const { path } = options
151 172