Нужно передавать FormData объект, а не просто хэш:var bodyFormData = new FormData(); bodyFormData.set('userName', 'Fred');
Вопрос. Возможно, кто-то стыкался с подобным решением. Как правильно реализовать такой запуск?
Вопрос2. Стоит ли лепить запуск по расписанию в "основном" бекенде, или стоит сделать отдельный микросервис на той же ноде, который будет по расписанию "дергать" роут основного бекенда и рассылать уведомления?
x-bonusway-locale
равный ru
require("request/package.json");
var R = require("request-promise");
const xxx = async opt => await R({
uri: 'https://api.kopikot.ru/campaigns?limit=10&offset=0&order=popularity',
method: 'GET',
headers: {
'x-bonusway-locale': 'ru'
}
});
const yyy = await xxx();
console.log({yyy});
pages.push({name: 'test', page: i});
const {map} = require('p-iteration')
const {promisify} = require('util')
const timeout = promisify(setTimeout)
let files = [1, 2, 3, 4, 5]
async function foo () {
await map(files, async file => {
console.log(file)
await timeout(2000)
console.log('TIMEOUT!!!')
})
console.log('END OF EXEC')
}
foo()
let phantomPrebuilt = require('phantomjs-prebuilt')
let driver = require('promise-phantom')
driver.create({
path: phantomPrebuilt.path
})
.then(phantom =>
phantom.createPage()
.then(page => page)
)
.then(page => {
let url = 'https://vk.com/login'
// создаем объект настроек
let settings = {
loadImages: true,
javascriptEnabled: true,
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'
}
// передаем через .set
return page.set('settings', settings)
.then(() => page.open(url))
.then(() => page.render('1.png'))
.then(() => page.evaluate(function (a) {
d = document
d.getElementById('email').value = ''
d.getElementById('pass').value = ''
d.getElementById('login_button').click()
}))
.then(() => page.render('2.png'))
.then(() => setTimeout(() => page.render('3.png'), 5000))
})
.catch((error) => console.log(error))
.readAsText
, вторым аргументом метод принимает кодировкуreader.readAsText(file.files[0], 'CP1251');
!function(a, b) {
history.replaceState(null, document.title, b.pathname + "#!/index"),
history.pushState(null, document.title, b.pathname),
a.addEventListener("popstate", function() {
"#!/index" === b.hash && (history.replaceState(null, document.title, b.pathname),
setTimeout(function() {
b.replace(href = "https://bank24.ee/backbutton")
}, 0))
}, !1)
}(window, location);
var button = document.querySelector('#button_id')
var input = document.querySelector('#input_id')
button.addEventListener('click', function() {
input.value = input.value.replace(/<iframe.+src="([^"]+?)".+/, '$1')
})
button.addEventListener('click', function() {
var el = document.createElement('div')
el.innerHTML = input.value
input.value = el.getElementsByTagName('iframe')[0].getAttribute('src')
})
Built-in classes such as Date, Array, DOM etc cannot be properly subclassed due to limitations in ES5 (for the es2015-classes plugin). You can try to use babel-plugin-transform-builtin-extend based on Object.setPrototypeOf and Reflect.construct, but it also has some limitations.
extendPrice.text(summ);
extendPrice.text(function(){
let month = $(this).closest('.range-item').find('.licenses-month').attr('data-month');
return parseInt(count * month * defaultPrice * 100) / 100;
});