fix(misskey-js) : misskey-jsの drive/file/create でファイルアップロードができない問題を修正 (#16028)
* fix(misskey-js): drive/file/createが動かない問題を修正 * CHANGELOG.mdに修正内容を追加
This commit is contained in:
parent
d378156212
commit
966e0812f5
|
@ -18,6 +18,8 @@
|
||||||
- Fix: アカウント削除が正常に行われないことがあった問題を修正
|
- Fix: アカウント削除が正常に行われないことがあった問題を修正
|
||||||
- Fix: outboxのページネーションが正しく行われない問題を修正
|
- Fix: outboxのページネーションが正しく行われない問題を修正
|
||||||
|
|
||||||
|
### Misskey.js
|
||||||
|
- Fix: misskey-jsの drive/file/create でファイルアップロードができない問題を修正
|
||||||
|
|
||||||
## 2025.6.0
|
## 2025.6.0
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ export class APIClient {
|
||||||
this.fetch(`${this.origin}/api/${endpoint}`, {
|
this.fetch(`${this.origin}/api/${endpoint}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: payload,
|
body: payload,
|
||||||
headers: {
|
headers: mediaType === 'multipart/form-data' ? {} : {
|
||||||
'Content-Type': mediaType,
|
'Content-Type': mediaType,
|
||||||
},
|
},
|
||||||
credentials: 'omit',
|
credentials: 'omit',
|
||||||
|
|
|
@ -94,11 +94,7 @@ describe('API', () => {
|
||||||
fetchMock.resetMocks();
|
fetchMock.resetMocks();
|
||||||
fetchMock.mockResponse(async (req) => {
|
fetchMock.mockResponse(async (req) => {
|
||||||
if (req.method == 'POST' && req.url == 'https://misskey.test/api/drive/files/create') {
|
if (req.method == 'POST' && req.url == 'https://misskey.test/api/drive/files/create') {
|
||||||
if (req.headers.get('Content-Type')?.includes('multipart/form-data')) {
|
return JSON.stringify({ id: 'foo' });
|
||||||
return JSON.stringify({ id: 'foo' });
|
|
||||||
} else {
|
|
||||||
return { status: 400 };
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return { status: 404 };
|
return { status: 404 };
|
||||||
}
|
}
|
||||||
|
@ -123,7 +119,7 @@ describe('API', () => {
|
||||||
expect(getFetchCall(fetchMock.mock.calls[0])).toEqual({
|
expect(getFetchCall(fetchMock.mock.calls[0])).toEqual({
|
||||||
url: 'https://misskey.test/api/drive/files/create',
|
url: 'https://misskey.test/api/drive/files/create',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
contentType: 'multipart/form-data',
|
contentType: undefined,
|
||||||
body: {
|
body: {
|
||||||
i: 'TOKEN',
|
i: 'TOKEN',
|
||||||
file: testFile,
|
file: testFile,
|
||||||
|
|
Loading…
Reference in New Issue