private void sinkRequestMeshInfo(TheRequestData request) { if (request != null) { request.ResponseMimeType = "application/json"; string errorText = ""; Dictionary <string, string> tQ = TheCommonUtils.ParseQueryString(request.RequestUri?.Query); if (tQ != null) { tQ.TryGetValue("MESHINFOTOKEN", out string meshInfoToken); if (tQ.TryGetValue("ORG", out string tOrg)) { Guid requestorMID = TheCommonUtils.CGuid(tOrg); if (requestorMID != Guid.Empty) { TheMeshInfoStatus meshInfoStatus = TheQueuedSenderRegistry.GetMeshInfoForNodeID(requestorMID, meshInfoToken); if (string.IsNullOrEmpty(meshInfoStatus?.StatusMessage)) { request.StatusCode = (int)eHttpStatusCode.OK; request.ResponseBuffer = TheCommonUtils.CUTF8String2Array(TheCommonUtils.SerializeObjectToJSONString(meshInfoStatus.MeshInfo)); } else { request.StatusCode = meshInfoStatus.StatusCode; //Better if meshInfoStatus also defines this as there are different messages (wrong MIT, too frequent tests etc) errorText = meshInfoStatus.StatusMessage; } } else { request.StatusCode = 400; errorText = "Invalid or badly formed ORG parameter."; } } else { request.StatusCode = 400; errorText = "No ORG parameter found for mesh info request."; } } else { request.StatusCode = (int)eHttpStatusCode.AccessDenied; errorText = "Access denied"; } if (!string.IsNullOrEmpty(errorText)) { TheErrorResponse errorResponse = new TheErrorResponse { Error = errorText, CTIM = DateTimeOffset.Now }; request.ResponseBuffer = TheCommonUtils.CUTF8String2Array(TheCommonUtils.SerializeObjectToJSONString(errorResponse)); } } }