services.ts 628 B

123456789101112131415161718192021222324
  1. import * as request from 'supertest'
  2. import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
  3. function getOEmbed (url: string, oembedUrl: string, format?: string, maxHeight?: number, maxWidth?: number) {
  4. const path = '/services/oembed'
  5. const query = {
  6. url: oembedUrl,
  7. format,
  8. maxheight: maxHeight,
  9. maxwidth: maxWidth
  10. }
  11. return request(url)
  12. .get(path)
  13. .query(query)
  14. .set('Accept', 'application/json')
  15. .expect(HttpStatusCode.OK_200)
  16. }
  17. // ---------------------------------------------------------------------------
  18. export {
  19. getOEmbed
  20. }