Skip to content

Commit

Permalink
[core] Use PATCH-endpoint for setting studio host (#339)
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars authored and bjoerge committed Nov 7, 2017
1 parent 63fdc3b commit 8033a3c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/@sanity/core/src/actions/deploy/deployAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,16 @@ async function checkDir(sourceDir) {

function validateHostname(value, client) {
const projectId = client.config().projectId
const uri = `/projects/${projectId}/host`
const host = value || ''
const uri = `/projects/${projectId}`
const studioHost = value || ''

// Check that it matches allowed character range
if (!/^[a-z0-9_-]+$/i.test(host)) {
if (!/^[a-z0-9_-]+$/i.test(studioHost)) {
return 'Hostname can contain only A-Z, 0-9, _ and -'
}

// Check that the hostname is not already taken
return client.request({uri, method: 'PUT', body: {studio: host}})
return client.request({uri, method: 'PATCH', body: {studioHost}})
.then(() => true)
.catch(() => 'Hostname already taken')
}

0 comments on commit 8033a3c

Please sign in to comment.