From 8dc031840332ffcc690dc5d1848faaa48a8b852f Mon Sep 17 00:00:00 2001 From: spencerwooo Date: Thu, 26 Jan 2023 14:16:05 +0800 Subject: [PATCH] feat: update axios and header type --- package.json | 2 +- pages/api/raw.ts | 4 ++-- pnpm-lock.yaml | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 87cbffc..9490145 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "@headlessui/react": "^1.7.7", "@tailwindcss/line-clamp": "^0.4.2", "awesome-debounce-promise": "^2.1.0", - "axios": "^1.1.2", + "axios": "^1.2.4", "cors": "^2.8.5", "crypto-js": "^4.1.1", "csstype": "^3.1.1", diff --git a/pages/api/raw.ts b/pages/api/raw.ts index 86d7fbd..c3b1efa 100644 --- a/pages/api/raw.ts +++ b/pages/api/raw.ts @@ -1,7 +1,7 @@ import { posix as pathPosix } from 'path' import type { NextApiRequest, NextApiResponse } from 'next' -import axios from 'axios' +import axios, { AxiosResponseHeaders } from 'axios' import Cors from 'cors' import { driveApi, cacheControlHeader } from '../../config/api.config' @@ -77,7 +77,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) }) headers['Cache-Control'] = cacheControlHeader // Send data stream as response - res.writeHead(200, headers) + res.writeHead(200, headers as AxiosResponseHeaders) stream.pipe(res) } else { res.redirect(data['@microsoft.graph.downloadUrl']) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5ac6905..c6acbf6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,7 +18,7 @@ specifiers: '@types/react-syntax-highlighter': ^15.5.6 autoprefixer: ^10.4.13 awesome-debounce-promise: ^2.1.0 - axios: ^1.1.2 + axios: ^1.2.4 cors: ^2.8.5 crypto-js: ^4.1.1 csstype: ^3.1.1 @@ -72,7 +72,7 @@ dependencies: '@headlessui/react': 1.7.7_biqbaboplfbrettd7655fr4n2y '@tailwindcss/line-clamp': 0.4.2_tailwindcss@3.2.4 awesome-debounce-promise: 2.1.0 - axios: 1.1.2 + axios: 1.2.4 cors: 2.8.5 crypto-js: 4.1.1 csstype: 3.1.1 @@ -991,8 +991,8 @@ packages: engines: {node: '>=4'} dev: true - /axios/1.1.2: - resolution: {integrity: sha512-bznQyETwElsXl2RK7HLLwb5GPpOLlycxHCtrpDR/4RqqBzjARaOTo3jz4IgtntWUYee7Ne4S8UHd92VCuzPaWA==} + /axios/1.2.4: + resolution: {integrity: sha512-lIQuCfBJvZB/Bv7+RWUqEJqNShGOVpk9v7P0ZWx5Ip0qY6u7JBAU6dzQPMLasU9vHL2uD8av/1FDJXj7n6c39w==} dependencies: follow-redirects: 1.15.2 form-data: 4.0.0