Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. public void TryLogin ()
  2. {
  3. UnityWebRequest req = UnityWebRequest.Get ("Your jenkins login url of network");
  4. req.method = "GET";
  5. req.SetRequestHeader("Authorization", "Basic " + Convert.ToBase64String (Encoding.UTF8.GetBytes ("jenkinsId:jenkinsPassword")));
  6.  
  7. StartCoroutine (WaitForLoginRequest (req));
  8. }
  9.  
  10. IEnumerator WaitForLoginRequest(UnityWebRequest req)
  11. {
  12. yield return req.Send ();
  13.  
  14. if (req.isError)
  15. {
  16. Debug.Log ("WWW Error: " + req.error);
  17. }
  18. else
  19. {
  20. Debug.Log("WWW Ok!:");
  21.  
  22. string response = Encoding.UTF8.GetString (req.downloadHandler.data);
  23. Debug.Log ("Response code = " + req.responseCode);
  24. Debug.Log ("String = " + response);
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement