1
0
Fork 0
peertube/shared/extra-utils/server/contact-form.ts

31 lines
653 B
TypeScript
Raw Normal View History

2019-01-09 09:14:29 -05:00
import * as request from 'supertest'
import { ContactForm } from '../../models/server'
function sendContactForm (options: {
2020-01-31 10:56:52 -05:00
url: string
fromEmail: string
fromName: string
subject: string
body: string
2019-01-09 09:14:29 -05:00
expectedStatus?: number
}) {
const path = '/api/v1/server/contact'
const body: ContactForm = {
fromEmail: options.fromEmail,
fromName: options.fromName,
subject: options.subject,
2019-01-09 09:14:29 -05:00
body: options.body
}
return request(options.url)
.post(path)
.send(body)
.expect(options.expectedStatus || 204)
}
// ---------------------------------------------------------------------------
export {
sendContactForm
}