File tree Expand file tree Collapse file tree
packages/midway-component-fetch/test Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ describe(fileShortPath(import.meta.url), function () {
1111 it ( 'Should work' , async ( ) => {
1212 const { httpRequest, app } = testConfig
1313
14- const path = `${ apiBase . prefix } /${ apiMethod . ip } `
14+ const path = `${ apiBase . fetch } /${ apiMethod . ip } `
1515 const resp = await httpRequest
1616 . get ( path )
1717
@@ -26,7 +26,7 @@ describe(fileShortPath(import.meta.url), function () {
2626 it . skip ( 'Should work self' , async ( ) => {
2727 const { httpRequest } = testConfig
2828
29- const path = `${ apiBase . prefix } /${ apiMethod . self } `
29+ const path = `${ apiBase . fetch } /${ apiMethod . self } `
3030 const resp = await httpRequest
3131 . get ( path )
3232
Original file line number Diff line number Diff line change @@ -6,14 +6,16 @@ import {
66} from '@midwayjs/core'
77
88import { FetchService } from '../../../../dist/index.js'
9+ import { apiBase , apiMethod } from '../../../api-test.js'
910
1011
11- @Controller ( '/fetch' )
12+ // @Controller ('/fetch')
13+ @Controller ( apiBase . fetch )
1214export class FetchController {
1315
1416 @Inject ( ) private readonly fetchService : FetchService
1517
16- @Get ( '/ip' )
18+ @Get ( `/ ${ apiMethod . ip } ` )
1719 async ip ( ) : Promise < string > {
1820 const url = 'http://ifconfig.me' // 222.233.10.1
1921
@@ -26,7 +28,7 @@ export class FetchController {
2628 return ip
2729 }
2830
29- @Get ( '/ self' )
31+ @Get ( `/ ${ apiMethod . self } ` )
3032 async self ( ) : Promise < string > {
3133 const url = 'http://127.0.0.1:7002/fetch/hello'
3234 const text = await this . fetchService . get < string > ( url , { dataType : 'text' } )
You can’t perform that action at this time.
0 commit comments