mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Use HTTP body instead of header for setting flows run state
This commit is contained in:
parent
6b6004ee70
commit
2f1f587c50
@ -83,7 +83,7 @@ module.exports = {
|
||||
postState: function(req,res) {
|
||||
const opts = {
|
||||
user: req.user,
|
||||
requestedState: req.get("Node-RED-Flow-Run-State-Change")||"",
|
||||
requestedState: req.body.state||"",
|
||||
req: apiUtils.getRequestLogObject(req)
|
||||
}
|
||||
runtimeAPI.flows.setState(opts).then(function(result) {
|
||||
|
@ -306,10 +306,7 @@ RED.deploy = (function() {
|
||||
$.ajax({
|
||||
url:"flows/state",
|
||||
type: "POST",
|
||||
data: {state: state},
|
||||
headers: {
|
||||
"Node-RED-Flow-Run-State-Change": state
|
||||
}
|
||||
data: {state: state}
|
||||
}).done(function(data,textStatus,xhr) {
|
||||
if (deployWasEnabled) {
|
||||
$("#red-ui-header-button-deploy").removeClass("disabled");
|
||||
|
@ -254,7 +254,7 @@ describe("api/admin/flows", function() {
|
||||
request(app)
|
||||
.post('/flows/state')
|
||||
.set('Accept', 'application/json')
|
||||
.set('Node-RED-Flow-Run-State-Change', 'stop')
|
||||
.send({state:'stop'})
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
if (err) {
|
||||
@ -295,7 +295,7 @@ describe("api/admin/flows", function() {
|
||||
request(app)
|
||||
.post('/flows/state')
|
||||
.set('Accept', 'application/json')
|
||||
.set('Node-RED-Flow-Run-State-Change', 'bad-state')
|
||||
.send({state:'bad-state'})
|
||||
.expect(400)
|
||||
.end(function(err,res) {
|
||||
if (err) {
|
||||
|
Loading…
Reference in New Issue
Block a user