code: func (nc *Conn) RequestWithContext(ctx context.Context, subj string, data []byte) (*Msg, error) {
  	if ctx == nil {
  		return nil, ErrInvalidContext
  	}
  	if nc == nil {
  		return nil, ErrInvalidConnection
  	}
  	// Check whether the context is done already before making
  	// the request.
  	if ctx.Err() != nil {
  		return nil, ctx.Err()
  	}
  
  	nc.mu.Lock()
  	// If user wants the old style.
  	if nc.Opts.UseOldRequestStyle {
  		nc.mu.Unlock()
  		return nc.oldRequestWithContext(ctx, subj, data)
  	}
  
  	// Do setup for the new style.
  	if nc.respMap == nil {
  		nc.initNewResp()
  	}
  	// Create literal Inbox and map to a chan msg.
  	mch := make(chan *Msg, RequestChanLen)
  	respInbox := nc.newRespInbox()
  	token := respToken(respInbox)
  	nc.respMap[token] = mch
  	createSub := nc.respMux == nil
  	ginbox := nc.respSub
  	nc.mu.Unlock()
  
  	if createSub {
  		// Make sure scoped subscription is setup only once.
  		var err error
  		nc.respSetup.Do(func() { err = nc.createRespMux(ginbox) })
  		if err != nil {
  			return nil, err
  		}
  	}
  
  	err := nc.PublishRequest(subj, respInbox, data)
  	if err != nil {
  		return nil, err
  	}
  
  	var ok bool
  	var msg *Msg
  
  	select {
  	case msg, ok = <-mch:
  		if !ok {
  			return nil, ErrConnectionClosed
  		}
  	case <-ctx.Done():
  		nc.mu.Lock()
  		delete(nc.respMap, token)
  		nc.mu.Unlock()
  		return nil, ctx.Err()
  	}
  
  	return msg, nil
  }
docs: // RequestWithContext takes a context, a subject and payload
  // in bytes and request expecting a single response.