MCPcopy Create free account
hub / github.com/TruthHun/BookStack / responseStatusCode

Function responseStatusCode

static/editor.md/lib/codemirror/mode/http/http.js:33–52  ·  view source on GitHub ↗
(stream, state)

Source from the content-addressed store, hash-verified

31 }
32
33 function responseStatusCode(stream, state) {
34 var code = stream.match(/^\d+/);
35 if (!code) return failFirstLine(stream, state);
36
37 state.cur = responseStatusText;
38 var status = Number(code[0]);
39 if (status >= 100 && status < 200) {
40 return "positive informational";
41 } else if (status >= 200 && status < 300) {
42 return "positive success";
43 } else if (status >= 300 && status < 400) {
44 return "positive redirect";
45 } else if (status >= 400 && status < 500) {
46 return "negative client-error";
47 } else if (status >= 500 && status < 600) {
48 return "negative server-error";
49 } else {
50 return "error";
51 }
52 }
53
54 function responseStatusText(stream, state) {
55 stream.skipToEnd();

Callers

nothing calls this directly

Calls 1

failFirstLineFunction · 0.85

Tested by

no test coverage detected