1
0
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:
Steve-Mcl 2022-06-27 18:03:14 +01:00
parent 6b6004ee70
commit 2f1f587c50
3 changed files with 4 additions and 7 deletions

View File

@ -83,7 +83,7 @@ module.exports = {
postState: function(req,res) { postState: function(req,res) {
const opts = { const opts = {
user: req.user, user: req.user,
requestedState: req.get("Node-RED-Flow-Run-State-Change")||"", requestedState: req.body.state||"",
req: apiUtils.getRequestLogObject(req) req: apiUtils.getRequestLogObject(req)
} }
runtimeAPI.flows.setState(opts).then(function(result) { runtimeAPI.flows.setState(opts).then(function(result) {

View File

@ -306,10 +306,7 @@ RED.deploy = (function() {
$.ajax({ $.ajax({
url:"flows/state", url:"flows/state",
type: "POST", type: "POST",
data: {state: state}, data: {state: state}
headers: {
"Node-RED-Flow-Run-State-Change": state
}
}).done(function(data,textStatus,xhr) { }).done(function(data,textStatus,xhr) {
if (deployWasEnabled) { if (deployWasEnabled) {
$("#red-ui-header-button-deploy").removeClass("disabled"); $("#red-ui-header-button-deploy").removeClass("disabled");

View File

@ -254,7 +254,7 @@ describe("api/admin/flows", function() {
request(app) request(app)
.post('/flows/state') .post('/flows/state')
.set('Accept', 'application/json') .set('Accept', 'application/json')
.set('Node-RED-Flow-Run-State-Change', 'stop') .send({state:'stop'})
.expect(200) .expect(200)
.end(function (err, res) { .end(function (err, res) {
if (err) { if (err) {
@ -295,7 +295,7 @@ describe("api/admin/flows", function() {
request(app) request(app)
.post('/flows/state') .post('/flows/state')
.set('Accept', 'application/json') .set('Accept', 'application/json')
.set('Node-RED-Flow-Run-State-Change', 'bad-state') .send({state:'bad-state'})
.expect(400) .expect(400)
.end(function(err,res) { .end(function(err,res) {
if (err) { if (err) {