Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
unified code style
Browse files Browse the repository at this point in the history
  • Loading branch information
nondanee committed Oct 20, 2018
1 parent f0d3b1f commit c37d559
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ exec('npm info NeteaseCloudMusicApi version', (err, stdout, stderr) => {
const app = express()

// CORS
app.use(function(req, res, next){
app.use((req, res, next) => {
if(req.path !== '/' && !req.path.includes('.')){
res.header({
'Access-Control-Allow-Credentials': true,
Expand All @@ -33,7 +33,7 @@ app.use(function(req, res, next){
})

// cookie parser
app.use(function(req, res, next){
app.use((req, res, next) => {
req.cookies = {}, (req.headers.cookie || '').split(/\s*;\s*/).forEach(pair => {
let crack = pair.indexOf('=')
if(crack < 1 || crack == pair.length - 1) return
Expand Down
4 changes: 2 additions & 2 deletions util/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const queryString = require('querystring')

request.debug = true

function chooseUserAgent(ua){
const chooseUserAgent = (ua) => {
const userAgentList = [
'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1',
'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1',
Expand Down Expand Up @@ -33,7 +33,7 @@ function chooseUserAgent(ua){
return userAgentList[index]
}

function createRequest(method, url, data, options){
const createRequest = (method, url, data, options) => {
return new Promise((resolve, reject) => {

let headers = {'User-Agent': chooseUserAgent(options.ua)}
Expand Down

0 comments on commit c37d559

Please sign in to comment.