Skip to content

Commit

Permalink
revert to sending pathname for location header
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-zucker committed Nov 6, 2020
1 parent 34dcbda commit d064f04
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ async fetch(uri, options = {}) {
slug = await _getAvailableUrl(pathname, slug, options) // jz add
pathname = _mungePath(pathname, slug, options)
const [status, , headers] = await self.storage(options).postContainer(pathname,options)
Object.assign(resOptions.headers, { location: mapPathToUrl(pathname, options) + '/' })
// Object.assign(resOptions.headers, { location: mapPathToUrl(pathname, options) + '/' })
Object.assign(resOptions.headers, { location: pathname + '/' })
Object.assign(resOptions.headers, headers)
return _response(null, resOptions, status)
}
Expand All @@ -205,7 +206,8 @@ async fetch(uri, options = {}) {
pathname = _mungePath(pathname, slug, options)
if (isLink(pathname, options)) return _response(null, resOptions, 405)
const [status, , headers] = await self.storage(options).putResource( pathname, options)
Object.assign(resOptions.headers, { location: mapPathToUrl(pathname, options) })
// Object.assign(resOptions.headers, { location: mapPathToUrl(pathname, options) })
Object.assign(resOptions.headers, { location: pathname })
Object.assign(resOptions.headers, headers)
return _response(null, resOptions, status)
}
Expand Down Expand Up @@ -467,6 +469,8 @@ function _mungePath(pathname, slug, options) {
return pathname;
}

/* not needed? location returns pathname, not URL
function mapPathToUrl (pathname, options) {
let prefix = options.rest_prefix;
if (prefix === 'file') {
Expand All @@ -475,6 +479,7 @@ function mapPathToUrl (pathname, options) {
}
return options.scheme + '//' + prefix + pathname
}
*/

} // end of fetch()
} // end of SolidRest()
Expand Down

0 comments on commit d064f04

Please sign in to comment.