File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -292,6 +292,9 @@ nweass
292
292
LambertCao
293
293
YuetongYu
294
294
kernelSue
295
+ RMsBoy
296
+ ZiyangZ
297
+ baoqin87
295
298
RealDuxy
296
299
NealChristmas
297
300
NorthSeacoder` ) ,
Original file line number Diff line number Diff line change @@ -2,15 +2,21 @@ const router = require("koa-router")();
2
2
const { success, fail } = require ( "../utils/request" ) ;
3
3
const fetch = require ( "node-fetch" ) ;
4
4
5
- router . get ( "/api/v1/github/content" , async ( ctx ) => {
6
- const { url } = ctx . query ;
7
- const res = await fetch ( url , {
5
+ router . all ( "/api/v1/github/content" , async ( ctx ) => {
6
+ const { url, ...params } = ctx . query ;
7
+ const dURL = new URL ( url ) ;
8
+ Object . keys ( params ) . forEach ( ( key ) =>
9
+ dURL . searchParams . append ( key , params [ key ] )
10
+ ) ;
11
+ console . log ( dURL ) ;
12
+ const res = await fetch ( dURL , {
8
13
headers : {
9
14
Accept : "application/json" ,
10
15
Authorization : `token ${ process . env . githubapi || "" } ` ,
11
16
} ,
12
17
} ) . then ( ( res ) => res . json ( ) ) ;
13
- if ( res . content ) {
18
+
19
+ if ( res ) {
14
20
ctx . body = success ( res ) ;
15
21
} else {
16
22
ctx . body = fail ( {
You can’t perform that action at this time.
0 commit comments