Skip to content

Commit

Permalink
Fix deprecated new Buffer()
Browse files Browse the repository at this point in the history
Switched to Buffer.from()

Signed-off-by: Ayrton Sparling <[email protected]>
  • Loading branch information
FallingSnow committed Jul 1, 2021
1 parent 3323069 commit fe4ed65
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/openapi-to-graphql/test/example_api3_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function startServer(PORT) {
const authMiddleware = (req, res, next) => {
if (req.headers.authorization) {
let encoded = req.headers.authorization.split(' ')[1]
let decoded = new Buffer(encoded, 'base64').toString('utf8').split(':')
let decoded = Buffer.from(encoded, 'base64').toString('utf8').split(':')

if (decoded.length === 2) {
let credentials = {
Expand Down Expand Up @@ -154,7 +154,7 @@ function startServer(PORT) {
res.send(NextWorks[req.params.authorId])
})

return new Promise(resolve => {
return new Promise((resolve) => {
server = app.listen(PORT, () => {
console.log(`Example API accessible on port ${PORT}`)
resolve()
Expand All @@ -166,7 +166,7 @@ function startServer(PORT) {
* Stops server.
*/
function stopServer() {
return new Promise(resolve => {
return new Promise((resolve) => {
server.close(() => {
console.log(`Stopped API server`)
resolve()
Expand Down
2 changes: 1 addition & 1 deletion packages/openapi-to-graphql/test/example_api_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ function startServer(PORT) {
const authMiddleware = (req, res, next) => {
if (req.headers.authorization) {
const encoded = req.headers.authorization.split(' ')[1]
const decoded = new Buffer(encoded, 'base64').toString('utf8').split(':')
const decoded = Buffer.from(encoded, 'base64').toString('utf8').split(':')

if (decoded.length === 2) {
const credentials = {
Expand Down

0 comments on commit fe4ed65

Please sign in to comment.