Commit 31a0906
authored
Fix inability to unmarshal nmagent request (#1695)
* Fix inability to unmarshal nmagent request
During the previous switchover to using the client from the
`nmagent` client (as opposed to the `cns/nmagent` client), an assumption
was made that "proxied" requests to NMAgent were provided by clients as
nested JSON. This assumption was wrong--they are Base64-encoded strings
of JSON. Even though they're ultimately similar, they're very different
from the perspective of the JSON unmarshaler. Consequently, this
restores the nested request body back to a []byte and performs the
second-stage decoding manually (similarly to how it was previously
done).
Fixes #1694
* Fix swallowed error when body is not JSON
In one instance, an error was accidentally swallowed because the
existing code does not return errors (it sets variables instead). This
makes controlling the flow of execution difficult. To fix this, the
offending code has been moved to a separate function where returns can
be used effectively.1 parent 3c08f86 commit 31a0906
File tree
4 files changed
+103
-25
lines changed- cns
- client
- restserver
4 files changed
+103
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| |||
497 | 496 | | |
498 | 497 | | |
499 | 498 | | |
500 | | - | |
| 499 | + | |
501 | 500 | | |
502 | 501 | | |
503 | 502 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
| |||
1033 | 1032 | | |
1034 | 1033 | | |
1035 | 1034 | | |
1036 | | - | |
| 1035 | + | |
1037 | 1036 | | |
1038 | 1037 | | |
1039 | 1038 | | |
1040 | 1039 | | |
1041 | 1040 | | |
1042 | 1041 | | |
1043 | | - | |
| 1042 | + | |
1044 | 1043 | | |
1045 | 1044 | | |
1046 | 1045 | | |
| |||
1062 | 1061 | | |
1063 | 1062 | | |
1064 | 1063 | | |
1065 | | - | |
| 1064 | + | |
1066 | 1065 | | |
1067 | 1066 | | |
1068 | 1067 | | |
1069 | 1068 | | |
1070 | 1069 | | |
1071 | 1070 | | |
1072 | | - | |
| 1071 | + | |
1073 | 1072 | | |
1074 | 1073 | | |
1075 | 1074 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | | - | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
1110 | 1111 | | |
1111 | 1112 | | |
1112 | 1113 | | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
1113 | 1142 | | |
1114 | 1143 | | |
1115 | 1144 | | |
| |||
1177 | 1206 | | |
1178 | 1207 | | |
1179 | 1208 | | |
1180 | | - | |
| 1209 | + | |
1181 | 1210 | | |
1182 | 1211 | | |
1183 | 1212 | | |
| |||
1187 | 1216 | | |
1188 | 1217 | | |
1189 | 1218 | | |
1190 | | - | |
1191 | | - | |
1192 | | - | |
1193 | | - | |
1194 | | - | |
1195 | | - | |
1196 | | - | |
1197 | | - | |
1198 | | - | |
1199 | | - | |
1200 | | - | |
1201 | | - | |
| 1219 | + | |
1202 | 1220 | | |
1203 | 1221 | | |
1204 | | - | |
| 1222 | + | |
1205 | 1223 | | |
1206 | 1224 | | |
1207 | 1225 | | |
| |||
1292 | 1310 | | |
1293 | 1311 | | |
1294 | 1312 | | |
1295 | | - | |
| 1313 | + | |
1296 | 1314 | | |
1297 | 1315 | | |
1298 | 1316 | | |
| |||
1303 | 1321 | | |
1304 | 1322 | | |
1305 | 1323 | | |
1306 | | - | |
| 1324 | + | |
1307 | 1325 | | |
1308 | 1326 | | |
1309 | 1327 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
747 | 747 | | |
748 | 748 | | |
749 | 749 | | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
750 | 812 | | |
751 | 813 | | |
752 | 814 | | |
| |||
764 | 826 | | |
765 | 827 | | |
766 | 828 | | |
767 | | - | |
| 829 | + | |
768 | 830 | | |
769 | 831 | | |
770 | 832 | | |
| |||
0 commit comments