public void TestLlRequestUrl() { TestHelpers.InMethod(); string requestId = m_lslApi.llRequestURL(); Assert.That(requestId, Is.Not.EqualTo(UUID.Zero.ToString())); string returnedUri; { // Check that URL is correctly set up Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls - 1)); Assert.That(m_engine.PostedEvents.ContainsKey(m_scriptItem.ItemID)); List <EventParams> events = m_engine.PostedEvents[m_scriptItem.ItemID]; Assert.That(events.Count, Is.EqualTo(1)); EventParams eventParams = events[0]; Assert.That(eventParams.EventName, Is.EqualTo("http_request")); UUID returnKey; string rawReturnKey = eventParams.Params[0].ToString(); string method = eventParams.Params[1].ToString(); returnedUri = eventParams.Params[2].ToString(); Assert.That(UUID.TryParse(rawReturnKey, out returnKey), Is.True); Assert.That(method, Is.EqualTo(ScriptBaseClass.URL_REQUEST_GRANTED)); Assert.That(Uri.IsWellFormedUriString(returnedUri, UriKind.Absolute), Is.True); } { // Check that request to URL works. string testResponse = "Hello World"; m_engine.ClearPostedEvents(); m_engine.PostEventHook += (itemId, evp) => m_lslApi.llHTTPResponse(evp.Params[0].ToString(), 200, testResponse); // Console.WriteLine("Trying {0}", returnedUri); AssertHttpResponse(returnedUri, testResponse); Assert.That(m_engine.PostedEvents.ContainsKey(m_scriptItem.ItemID)); List <EventParams> events = m_engine.PostedEvents[m_scriptItem.ItemID]; Assert.That(events.Count, Is.EqualTo(1)); EventParams eventParams = events[0]; Assert.That(eventParams.EventName, Is.EqualTo("http_request")); UUID returnKey; string rawReturnKey = eventParams.Params[0].ToString(); string method = eventParams.Params[1].ToString(); string body = eventParams.Params[2].ToString(); Assert.That(UUID.TryParse(rawReturnKey, out returnKey), Is.True); Assert.That(method, Is.EqualTo("GET")); Assert.That(body, Is.EqualTo("")); } }