request.test.ts 837 B

12345678910111213141516171819202122232425262728
  1. import tcb from '../../src/index'
  2. import config from '../config.local'
  3. describe('tcb.init: 初始化tcb', () => {
  4. const app = tcb.init(config)
  5. it('test', async () => {
  6. try {
  7. const resp: any = await app.request(
  8. {
  9. proxy: '',
  10. method: 'GET',
  11. timeout: 1000,
  12. url: 'http://127.0.0.1:55534'
  13. },
  14. {
  15. op: '~~~~~',
  16. seqId: '123134123413'
  17. // retryOptions: {
  18. // timeouts: [10, 20, 30, 40, 50]
  19. // }
  20. }
  21. )
  22. console.log(resp.attempt, resp.body, 'result|||||||||||||||||||||||')
  23. } catch (e) {
  24. // console.error(e.attempt)
  25. }
  26. })
  27. })