Allow the zed app to connect to both the old and new rpc endpoints

In the case of the new Next.js app, the app will follow a redirect
from 'zed.dev/rpc' to the subdomain where the rust service is hosted.
Until then, the app will connect directly to zed.dev/rpc.
This commit is contained in:
Max Brunsfeld 2022-01-03 15:20:40 -08:00
parent f499a1dfc2
commit a080ae98c6
16 changed files with 107 additions and 72 deletions

View file

@ -1,5 +1,5 @@
use crate::{assets::Assets, build_window_options, build_workspace, AppState};
use client::{http::ServerResponse, test::FakeHttpClient, ChannelList, Client, UserStore};
use client::{test::FakeHttpClient, ChannelList, Client, UserStore};
use gpui::{AssetSource, MutableAppContext};
use language::LanguageRegistry;
use parking_lot::Mutex;
@ -20,8 +20,8 @@ pub fn test_app_state(cx: &mut MutableAppContext) -> Arc<AppState> {
editor::init(cx, &mut entry_openers);
let (settings_tx, settings) = watch::channel_with(build_settings(cx));
let themes = ThemeRegistry::new(Assets, cx.font_cache().clone());
let client = Client::new();
let http = FakeHttpClient::new(|_| async move { Ok(ServerResponse::new(404)) });
let http = FakeHttpClient::with_404_response();
let client = Client::new(http.clone());
let user_store = cx.add_model(|cx| UserStore::new(client.clone(), http, cx));
let mut languages = LanguageRegistry::new();
languages.add(Arc::new(language::Language::new(