request.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { AxiosPromise, AxiosRequestConfig } from "axios";
  2. import { HoppRESTRequest } from "@hoppscotch/data";
  3. /**
  4. * Provides definition to object returned by createRequest.
  5. * @property {function} request Axios request promise, executed to get axios
  6. * response promise.
  7. * @property {string} path Path of request within collection file.
  8. * @property {string} name Name of request within collection
  9. * @property {string} testScript Stringified hoppscotch testScript, used while
  10. * running testRunner.
  11. */
  12. export interface RequestStack {
  13. request: () => AxiosPromise<any>;
  14. path: string;
  15. }
  16. /**
  17. * Provides definition to axios request promise's request parameter.
  18. * @property {boolean} supported - Boolean check for supported or unsupported requests.
  19. */
  20. export interface RequestConfig extends AxiosRequestConfig {
  21. displayUrl?: string;
  22. }
  23. export interface EffectiveHoppRESTRequest extends HoppRESTRequest {
  24. /**
  25. * The effective final URL.
  26. *
  27. * This contains path, params and environment variables all applied to it
  28. */
  29. effectiveFinalURL: string;
  30. effectiveFinalDisplayURL?: string;
  31. effectiveFinalHeaders: {
  32. key: string;
  33. value: string;
  34. active: boolean;
  35. description: string;
  36. }[];
  37. effectiveFinalParams: {
  38. key: string;
  39. value: string;
  40. active: boolean;
  41. description: string;
  42. }[];
  43. effectiveFinalBody: FormData | string | null;
  44. }