 		requestOptions: opts
 		parsedUrl: parsedUrl
 
-	request = httpOrHttps.request opts, (response) ->
+	request = httpOrHttps.request opts, Meteor.bindEnvironment (response) ->
 		if response.statusCode is 301 and response.headers.location?
 			request.abort()
 			console.log response.headers.location

URL = Npm.require('url')
http = Npm.require('http')
https = Npm.require('https')
querystring = Npm.require('querystring')

OEmbed = {}


		if response.statusCode isnt 200
			return callback null, {parsedUrl: parsedUrl}

		chunks = []
		chunksTotalLength = 0
		response.on 'data', (chunk) ->
			chunks.push chunk
			chunksTotalLength += chunk.length
			if chunksTotalLength > 250000
				request.abort()

		response.on 'end', Meteor.bindEnvironment ->
			buffer = Buffer.concat(chunks)

			try
				if response.headers['content-encoding'] is 'gzip'
					buffer = gunzipSync buffer
				else if response.headers['content-encoding'] is 'deflate'
					buffer = inflateSync buffer

			callback null, {
				headers: response.headers
				body: buffer.toString()
				parsedUrl: parsedUrl
			}

