require exampleUrl and urlPattern if using staticExample (#2132)

This commit is contained in:
chris48s
2018-10-01 20:48:05 +01:00
committed by GitHub
parent aef9a4efd1
commit ebe0c71488

View File

@@ -127,6 +127,12 @@ class BaseService {
} is missing required previewUrl or staticExample`
)
}
if (staticExample && !urlPattern) {
throw new Error('Must declare a urlPattern if using staticExample')
}
if (staticExample && !exampleUrl) {
throw new Error('Must declare an exampleUrl if using staticExample')
}
const stringified = queryString.stringify(query)
const suffix = stringified ? `?${stringified}` : ''